+ for (i = 0; mask_names[i].name; i++)
+ if (0 == strcmp(mask_names[i].name, name))
+ {
+ return mask_names[i].mask;
+ }
+ if ( (i>=MAX_MASK_NAMES) || (next_log_bit & (1<<31) ))
+ {
+ 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 = (char *) malloc(strlen(name)+1);
+ strcpy(mask_names[i].name, name);
+ mask_names[i+1].name = NULL;
+ mask_names[i+1].mask = 0;
+ 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));
+ internal_log_init();
+
+ 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",
+ mask_names[i].mask, n,
+ strcmp(n,name) ? name : "");
+ return mask_names[i].mask;
+ }
+ 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)
+{
+ internal_log_init(); /* since l_level may be affected */
+ return yaz_log_mask_str_x(str, l_level);
+}
+
+int yaz_log_mask_str_x(const char *str, int level)
+{
+ const char *p;
+
+ internal_log_init();