+ init_mutex();
+ nmem_mutex_enter(log_mutex);
+ for (i = 0; mask_names[i].name; i++)
+ if (0 == strcmp(mask_names[i].name, name))
+ {
+ nmem_mutex_leave(log_mutex);
+ return mask_names[i].mask;
+ }
+ if ( (i>=MAX_MASK_NAMES) || (next_log_bit >= 1<<31 ))
+ {
+ nmem_mutex_leave(log_mutex);
+ yaz_log(YLOG_WARN, "No more log bits left, not logging '%s'", name);
+ return 0;
+ }
+ mask_names[i].mask = next_log_bit;
+ next_log_bit = next_log_bit<<1;
+ mask_names[i].name = malloc(strlen(name)+1);
+ strcpy(mask_names[i].name, name);
+ mask_names[i+1].name = NULL;
+ mask_names[i+1].mask = 0;
+ nmem_mutex_leave(log_mutex);
+ return mask_names[i].mask;
+}
+
+int yaz_log_module_level(const char *name)
+{
+ int i;
+ char clean[255];
+ char *n = clean_name(name, strlen(name), clean, sizeof(clean));
+ init_mutex();
+
+ nmem_mutex_enter(log_mutex);
+ for (i = 0; mask_names[i].name; i++)
+ if (0==strcmp(n, mask_names[i].name))
+ {
+ nmem_mutex_leave(log_mutex);
+ yaz_log(YLOG_LOGLVL, "returning log bit 0x%x for '%s' %s",
+ mask_names[i].mask, n,
+ strcmp(n,name) ? name : "");
+ return mask_names[i].mask;
+ }
+ nmem_mutex_leave(log_mutex);
+ 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)
+{
+ return yaz_log_mask_str_x(str, YLOG_DEFAULT_LEVEL);
+}
+
+int yaz_log_mask_str_x(const char *str, int level)
+{
+ const char *p;