Changeset 0a6a996 in mainline
- Timestamp:
- 2012-08-16T09:21:59Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b52dd1de
- Parents:
- 6e9e12b
- Location:
- uspace/srv/logger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/logger/logger.h
r6e9e12b r0a6a996 44 44 #define NAME "logger" 45 45 #define MAX_NAMESPACE_LENGTH 256 46 #define LOG_LEVEL_USE_DEFAULT (LVL_LIMIT + 1) 46 47 47 48 typedef struct logging_namespace logging_namespace_t; -
uspace/srv/logger/namespace.c
r6e9e12b r0a6a996 55 55 static LIST_INITIALIZE(namespace_list); 56 56 57 static log_level_t namespace_get_actual_log_level(logging_namespace_t *namespace) 58 { 59 fibril_mutex_lock(&namespace->guard); 60 log_level_t level = namespace->level; 61 fibril_mutex_unlock(&namespace->guard); 62 63 if (level == LOG_LEVEL_USE_DEFAULT) 64 level = get_default_logging_level(); 65 66 return level; 67 } 68 57 69 static logging_namespace_t *namespace_find_no_lock(const char *name) 58 70 { … … 100 112 } 101 113 102 namespace->level = get_default_logging_level();114 namespace->level = LOG_LEVEL_USE_DEFAULT; 103 115 104 116 fibril_mutex_initialize(&namespace->guard); … … 188 200 bool namespace_has_reader(logging_namespace_t *namespace, log_level_t level) 189 201 { 190 fibril_mutex_lock(&namespace->guard); 191 bool has_reader = level <= namespace->level; 192 fibril_mutex_unlock(&namespace->guard); 193 return has_reader; 202 return level <= namespace_get_actual_log_level(namespace); 194 203 } 195 204 … … 208 217 void namespace_add_message(logging_namespace_t *namespace, const char *message, log_level_t level) 209 218 { 210 if (level <= namespace ->level) {219 if (level <= namespace_get_actual_log_level(namespace)) { 211 220 printf("[%s %d]: %s\n", namespace->name, level, message); 212 221 fprintf(namespace->logfile, "[%d]: %s\n", level, message);
Note:
See TracChangeset
for help on using the changeset viewer.