category.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * This file is part of the zlog Library.
  3. *
  4. * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING in base directory.
  7. */
  8. #ifndef __zlog_category_h
  9. #define __zlog_category_h
  10. #include "zc_defs.h"
  11. #include "thread.h"
  12. typedef struct zlog_category_s {
  13. char name[MAXLEN_PATH + 1];
  14. size_t name_len;
  15. unsigned char level_bitmap[32];
  16. unsigned char level_bitmap_backup[32];
  17. zc_arraylist_t *fit_rules;
  18. zc_arraylist_t *fit_rules_backup;
  19. } zlog_category_t;
  20. zlog_category_t *zlog_category_new(const char *name, zc_arraylist_t * rules);
  21. void zlog_category_del(zlog_category_t * a_category);
  22. void zlog_category_profile(zlog_category_t *a_category, int flag);
  23. int zlog_category_update_rules(zlog_category_t * a_category, zc_arraylist_t * new_rules);
  24. void zlog_category_commit_rules(zlog_category_t * a_category);
  25. void zlog_category_rollback_rules(zlog_category_t * a_category);
  26. int zlog_category_output(zlog_category_t * a_category, zlog_thread_t * a_thread);
  27. #define zlog_category_needless_level(a_category, lv) \
  28. a_category && !((a_category->level_bitmap[lv/8] >> (7 - lv % 8)) & 0x01)
  29. #endif