- if (mutex_init_flag)
- return;
- mutex_init_flag = 1; /* here, 'cause nmem_mutex_create may call yaz_log */
+static void yaz_log_unlock(void)
+{
+ yaz_mutex_leave(log_mutex);
+}
+
+void yaz_log_init_globals(void)
+{
+ char *env;
if ( (l_level & YLOG_FLUSH) != (level & YLOG_FLUSH) )
{
l_level = level;
yaz_log_reopen(); /* make sure we set buffering right */
if ( (l_level & YLOG_FLUSH) != (level & YLOG_FLUSH) )
{
l_level = level;
yaz_log_reopen(); /* make sure we set buffering right */
#if HAVE_LOCALTIME_R
localtime_r(&cur_time, tm);
#else
tm = localtime(&cur_time);
#endif
yaz_log_open_check(tm, 1, filemode);
#if HAVE_LOCALTIME_R
localtime_r(&cur_time, tm);
#else
tm = localtime(&cur_time);
#endif
yaz_log_open_check(tm, 1, filemode);
{
strftime(dst, sz, fmt, tm);
}
{
strftime(dst, sz, fmt, tm);
}
{ /* no format, default to new */
l_actual_format = l_new_default_format;
{ /* no format, default to new */
l_actual_format = l_new_default_format;
}
if (0==strcmp(fmt, "old"))
{ /* force the old format */
l_actual_format = l_old_default_format;
}
if (0==strcmp(fmt, "old"))
{ /* force the old format */
l_actual_format = l_old_default_format;
}
/* else use custom format */
strncpy(l_custom_format, fmt, TIMEFORMAT_LEN-1);
}
/* else use custom format */
strncpy(l_custom_format, fmt, TIMEFORMAT_LEN-1);
strncpy(namebuf, name, len);
namebuf[len] = '\0';
while ((p = strchr(start, '/')))
strncpy(namebuf, name, len);
namebuf[len] = '\0';
while ((p = strchr(start, '/')))
int i;
char clean[255];
char *n = clean_name(name, strlen(name), clean, sizeof(clean));
int i;
char clean[255];
char *n = clean_name(name, strlen(name), clean, sizeof(clean));
for (i = 0; mask_names[i].name; i++)
if (0==strcmp(n, mask_names[i].name))
{
yaz_log(YLOG_LOGLVL, "returning log bit 0x%x for '%s' %s",
for (i = 0; mask_names[i].name; i++)
if (0==strcmp(n, mask_names[i].name))
{
yaz_log(YLOG_LOGLVL, "returning log bit 0x%x for '%s' %s",
strcmp(n,name) ? name : "");
return mask_names[i].mask;
}
strcmp(n,name) ? name : "");
return mask_names[i].mask;
}
- yaz_log(YLOG_LOGLVL, "returning NO log bit for '%s' %s", n,
+ yaz_log(YLOG_LOGLVL, "returning NO log bit for '%s' %s", n,
strcmp(n, name) ? name : "" );
return 0;
}
int yaz_log_mask_str(const char *str)
{
strcmp(n, name) ? name : "" );
return 0;
}
int yaz_log_mask_str(const char *str)
{
{
char clean[509];
char *n = clean_name(str, (size_t) (p - str), clean, sizeof(clean));
{
char clean[509];
char *n = clean_name(str, (size_t) (p - str), clean, sizeof(clean));