category.h 1.13 KB
Newer Older
Hardy Simpson's avatar
Hardy Simpson committed
1
/*
Hardy Simpson's avatar
Hardy Simpson committed
2
 * This file is part of the zlog Library.
Hardy Simpson's avatar
Hardy Simpson committed
3
 *
Hardy Simpson's avatar
Hardy Simpson committed
4
 * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
Hardy Simpson's avatar
Hardy Simpson committed
5
 *
6
 * Licensed under the LGPL v2.1, see the file COPYING in base directory.
Hardy Simpson's avatar
Hardy Simpson committed
7 8
 */

Hardy Simpson's avatar
Hardy Simpson committed
9 10
#ifndef __zlog_category_h
#define __zlog_category_h
Hardy Simpson's avatar
Hardy Simpson committed
11 12

#include "zc_defs.h"
13
#include "thread.h"
Hardy Simpson's avatar
Hardy Simpson committed
14

15
typedef struct zlog_category_s {
16 17
	char name[MAXLEN_PATH + 1];
	size_t name_len;
Hardy Simpson's avatar
Hardy Simpson committed
18 19
	unsigned char level_bitmap[32];
	unsigned char level_bitmap_backup[32];
20 21
	zc_arraylist_t *fit_rules;
	zc_arraylist_t *fit_rules_backup;
Hardy Simpson's avatar
Hardy Simpson committed
22
} zlog_category_t;
Hardy Simpson's avatar
Hardy Simpson committed
23

24
zlog_category_t *zlog_category_new(const char *name, zc_arraylist_t * rules);
25 26
void zlog_category_del(zlog_category_t * a_category);
void zlog_category_profile(zlog_category_t *a_category, int flag);
Hardy Simpson's avatar
Hardy Simpson committed
27

28 29 30 31
int zlog_category_update_rules(zlog_category_t * a_category, zc_arraylist_t * new_rules);
void zlog_category_commit_rules(zlog_category_t * a_category);
void zlog_category_rollback_rules(zlog_category_t * a_category);

32 33
int zlog_category_output(zlog_category_t * a_category, zlog_thread_t * a_thread);

Hardy Simpson's avatar
Hardy Simpson committed
34 35 36
#define zlog_category_needless_level(a_category, lv) \
        !((a_category->level_bitmap[lv/8] >> (7 - lv % 8)) & 0x01)

Hardy Simpson's avatar
Hardy Simpson committed
37 38

#endif