Changeset 793cce15 in mainline for uspace/lib/c/include/io/log.h
- Timestamp:
- 2012-08-16T14:22:56Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 32b26cf7
- Parents:
- 9a53e00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/log.h
r9a53e00 r793cce15 36 36 37 37 #include <stdarg.h> 38 #include <inttypes.h> 38 39 #include <bool.h> 39 40 … … 50 51 } log_level_t; 51 52 53 typedef sysarg_t log_context_t; 54 #define PRIlogctx PRIxn 55 #define LOG_CONTEXT_DEFAULT 0 56 52 57 extern const char *log_level_str(log_level_t); 53 58 extern int log_level_from_str(const char *, log_level_t *); 54 59 55 extern bool _log_shall_record(log_ level_t);60 extern bool _log_shall_record(log_context_t, log_level_t); 56 61 extern int log_init(const char *, log_level_t); 57 62 58 #define log_msg(level, format, ...) \ 63 extern log_context_t log_context_create(const char *); 64 65 #define log_ctx_msg(context, level, format, ...) \ 59 66 do { \ 60 if (_log_shall_record(( level))) { \61 _log_ msg(level, format, ##__VA_ARGS__); \67 if (_log_shall_record((context), (level))) { \ 68 _log_ctx_msg((context), (level), format, ##__VA_ARGS__); \ 62 69 } \ 63 70 } while (false) 64 71 65 #define log_ msgv(level, format, args) \72 #define log_ctx_msgv(context, level, format, args) \ 66 73 do { \ 67 if (_log_shall_record(( level))) { \68 _log_ msgv(level, format, args); \74 if (_log_shall_record((context), (level))) { \ 75 _log_ctx_msgv((context), (level), format, args); \ 69 76 } \ 70 77 } while (false) 71 78 72 extern void _log_msg(log_level_t, const char *, ...); 73 extern void _log_msgv(log_level_t, const char *, va_list); 79 #define log_msg(level, format, ...) \ 80 log_ctx_msg(LOG_CONTEXT_DEFAULT, (level), (format), ##__VA_ARGS__) 81 #define log_msgv(level, format, args) \ 82 log_ctx_msgv(LOG_CONTEXT_DEFAULT, (level), (format), (args)) 83 84 extern void _log_ctx_msg(log_context_t, log_level_t, const char *, ...); 85 extern void _log_ctx_msgv(log_context_t, log_level_t, const char *, va_list); 74 86 75 87 #endif
Note:
See TracChangeset
for help on using the changeset viewer.