* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: log.h,v 1.6 2002-06-18 21:30:39 adam Exp $
+ * $Id: log.h,v 1.7 2002-08-29 09:58:42 adam Exp $
*/
#ifndef LOG_H
YAZ_EXPORT void yaz_log_init_file (const char *fname);
YAZ_EXPORT void yaz_log_init_level (int level);
YAZ_EXPORT void yaz_log_init_prefix (const char *prefix);
+YAZ_EXPORT void yaz_log_init_prefix2 (const char *prefix);
YAZ_EXPORT void yaz_log(int level, const char *fmt, ...)
#ifdef __GNUC__
* Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: log.c,v 1.27 2002-06-18 21:30:39 adam Exp $
+ * $Id: log.c,v 1.28 2002-08-29 09:58:42 adam Exp $
*/
#if HAVE_CONFIG_H
static int l_level = LOG_DEFAULT_LEVEL;
static FILE *l_file = NULL;
static char l_prefix[512] = "";
+static char l_prefix2[512] = "";
static struct {
int mask;
*l_prefix = 0;
}
+void yaz_log_init_prefix2 (const char *prefix)
+{
+ if (prefix && *prefix)
+ sprintf(l_prefix2, "%.511s ", prefix);
+ else
+ *l_prefix2 = 0;
+}
+
void yaz_log_init(int level, const char *prefix, const char *fname)
{
yaz_log_init_level (level);
ti = time(0);
tim = localtime(&ti);
strftime(tbuf, 50, "%H:%M:%S-%d/%m", tim);
- fprintf(l_file, "%s: %s%s %s\n", tbuf, l_prefix, flags, buf);
+ fprintf(l_file, "%s: %s%s %s%s\n", tbuf, l_prefix, flags,
+ l_prefix2, buf);
fflush(l_file);
if (end_hook_func)
(*end_hook_func)(o_level, buf, end_hook_info);