int log_level->enum UC_LOG_LEVEL
This commit is contained in:
@@ -108,7 +108,7 @@ struct UCLogModule {
|
|||||||
* log statements with a level >= the log_level
|
* log statements with a level >= the log_level
|
||||||
* are actually logged, but the log_level of a destination
|
* are actually logged, but the log_level of a destination
|
||||||
* can restrict the logging further*/
|
* can restrict the logging further*/
|
||||||
int log_level;
|
enum UC_LOG_LEVEL log_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A collection of struct UCLogModule */
|
/* A collection of struct UCLogModule */
|
||||||
@@ -168,7 +168,7 @@ const char *uc_ll_2_str(enum UC_LOG_LEVEL l);
|
|||||||
* @return An opaque uc_log_destination that can be added as a destination to
|
* @return An opaque uc_log_destination that can be added as a destination to
|
||||||
* the ucore logging system
|
* the ucore logging system
|
||||||
*/
|
*/
|
||||||
struct UCLogDestination *uc_log_new_stderr(int log_level, int log_location);
|
struct UCLogDestination *uc_log_new_stderr(enum UC_LOG_LEVEL log_level, int log_location);
|
||||||
|
|
||||||
/* creates a new uc_log_destination for logging to syslog
|
/* creates a new uc_log_destination for logging to syslog
|
||||||
*
|
*
|
||||||
@@ -181,7 +181,7 @@ struct UCLogDestination *uc_log_new_stderr(int log_level, int log_location);
|
|||||||
* @return An opaque uc_log_destination that can be added as a destination to
|
* @return An opaque uc_log_destination that can be added as a destination to
|
||||||
* the ucore logging system
|
* the ucore logging system
|
||||||
*/
|
*/
|
||||||
struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, int log_level, int log_location);
|
struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, enum UC_LOG_LEVEL log_level, int log_location);
|
||||||
|
|
||||||
/* creates a new uc_log_destination for printing on stderr.
|
/* creates a new uc_log_destination for printing on stderr.
|
||||||
*
|
*
|
||||||
@@ -192,7 +192,7 @@ struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, int
|
|||||||
* @param return An opaque uc_log_destination that can be added as a destination to
|
* @param return An opaque uc_log_destination that can be added as a destination to
|
||||||
* the ucore logging system
|
* the ucore logging system
|
||||||
*/
|
*/
|
||||||
struct UCLogDestination *uc_log_new_file(const char *filename, int log_level, int log_location);
|
struct UCLogDestination *uc_log_new_file(const char *filename, enum UC_LOG_LEVEL log_level, int log_location);
|
||||||
|
|
||||||
/** Add a uc_log_destination to the logging system.
|
/** Add a uc_log_destination to the logging system.
|
||||||
*
|
*
|
||||||
@@ -297,7 +297,7 @@ int uc_log_reopen_files(void);
|
|||||||
*/
|
*/
|
||||||
void uc_log_init(struct UCLogModules *user_modules);
|
void uc_log_init(struct UCLogModules *user_modules);
|
||||||
|
|
||||||
void uc_logf(int log_level, int module, int raw,
|
void uc_logf(enum UC_LOG_LEVEL log_level, int module, int raw,
|
||||||
const char *location, const char *fmt, ...)
|
const char *location, const char *fmt, ...)
|
||||||
__attribute__((format(printf, 5, 6)));
|
__attribute__((format(printf, 5, 6)));
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -30,8 +30,8 @@ enum UC_LOG_DESTINATION {
|
|||||||
#define UC_MAX_RENAME_CNT (128)
|
#define UC_MAX_RENAME_CNT (128)
|
||||||
|
|
||||||
//used to realise per destination settings
|
//used to realise per destination settings
|
||||||
struct UCLogModule_setting {
|
struct UCLogModuleSetting {
|
||||||
int log_level;
|
enum UC_LOG_LEVEL log_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UCLogArgs;
|
struct UCLogArgs;
|
||||||
@@ -41,10 +41,10 @@ struct UCLogDestination {
|
|||||||
struct TailQ entry;
|
struct TailQ entry;
|
||||||
enum UC_LOG_DESTINATION dest_type;
|
enum UC_LOG_DESTINATION dest_type;
|
||||||
//log level for this destination
|
//log level for this destination
|
||||||
int log_level;
|
enum UC_LOG_LEVEL log_level;
|
||||||
//Whether to log the source file name and line number
|
//Whether to log the source file name and line number
|
||||||
int log_location;
|
int log_location;
|
||||||
struct UCLogModule_setting *module_settings;
|
struct UCLogModuleSetting *module_settings;
|
||||||
union {
|
union {
|
||||||
//for syslog openlog()
|
//for syslog openlog()
|
||||||
struct {
|
struct {
|
||||||
@@ -68,7 +68,7 @@ struct UCLogDestination {
|
|||||||
struct UCLogArgs {
|
struct UCLogArgs {
|
||||||
struct UCLogDestination *dest;
|
struct UCLogDestination *dest;
|
||||||
const struct UCLogModule *module;
|
const struct UCLogModule *module;
|
||||||
int log_level;
|
enum UC_LOG_LEVEL log_level;
|
||||||
const char *location;
|
const char *location;
|
||||||
int raw;
|
int raw;
|
||||||
};
|
};
|
||||||
@@ -176,7 +176,7 @@ static int uc_log_init_common(struct UCLogDestination *dest)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UCLogDestination *uc_log_new_stderr(int log_level, int log_location)
|
struct UCLogDestination *uc_log_new_stderr(enum UC_LOG_LEVEL log_level, int log_location)
|
||||||
{
|
{
|
||||||
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ struct UCLogDestination *uc_log_new_stderr(int log_level, int log_location)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, int log_level, int log_location)
|
struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, enum UC_LOG_LEVEL log_level, int log_location)
|
||||||
{
|
{
|
||||||
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
||||||
char *id;
|
char *id;
|
||||||
@@ -231,7 +231,7 @@ struct UCLogDestination *uc_log_new_syslog(const char *ident, int facility, int
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UCLogDestination *uc_log_new_file(const char *filename, int log_level, int log_location)
|
struct UCLogDestination *uc_log_new_file(const char *filename, enum UC_LOG_LEVEL log_level, int log_location)
|
||||||
{
|
{
|
||||||
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
struct UCLogDestination *dest = calloc(1, sizeof *dest);
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@@ -679,7 +679,7 @@ static inline void uc_log_file_rotate_if_neeed(struct UCLogDestination *dest, ti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uc_logf(int log_level, int module, int raw,
|
void uc_logf(enum UC_LOG_LEVEL log_level, int module, int raw,
|
||||||
const char *location, const char *fmt, ...)
|
const char *location, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -693,7 +693,7 @@ void uc_logf(int log_level, int module, int raw,
|
|||||||
UC_TAILQ_FOREACH_CONTAINER(dest, entry, &g_destinations) {
|
UC_TAILQ_FOREACH_CONTAINER(dest, entry, &g_destinations) {
|
||||||
const struct UCLogModule *log_module;
|
const struct UCLogModule *log_module;
|
||||||
va_list apc;
|
va_list apc;
|
||||||
int module_log_level;
|
enum UC_LOG_LEVEL module_log_level;
|
||||||
|
|
||||||
|
|
||||||
//destnation level
|
//destnation level
|
||||||
|
|||||||
Reference in New Issue
Block a user