Changeset e0c836e8 in mainline
- Timestamp:
- 2012-09-07T08:29:43Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 42bde6a
- Parents:
- 70253688
- Location:
- uspace/lib/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/log.c
r70253688 re0c836e8 43 43 #include <ns.h> 44 44 45 /** Id of the first log we create at logger. */ 45 46 static sysarg_t default_log_id; 46 47 … … 48 49 static const char *log_prog_name; 49 50 51 /** Names of individual log levels. */ 50 52 static const char *log_level_names[] = { 51 53 "fatal", … … 64 66 #define MESSAGE_BUFFER_SIZE 4096 65 67 68 /** Send formatted message to the logger service. 69 * 70 * @param session Initialized IPC session with the logger. 71 * @param log Log to use. 72 * @param level Verbosity level of the message. 73 * @param message The actual message. 74 * @return Error code of the conversion or EOK on success. 75 */ 66 76 static int logger_message(async_sess_t *session, log_t log, log_level_t level, char *message) 67 77 { … … 98 108 } 99 109 110 /** Get name of the log level. 111 * 112 * @param level The log level. 113 * @return String name or "unknown". 114 */ 100 115 const char *log_level_str(log_level_t level) 101 116 { … … 106 121 } 107 122 123 /** Convert log level name to the enum. 124 * 125 * @param[in] name Log level name or log level number. 126 * @param[out] level_out Where to store the result (set to NULL to ignore). 127 * @return Error code of the conversion or EOK on success. 128 */ 108 129 int log_level_from_str(const char *name, log_level_t *level_out) 109 130 { … … 137 158 /** Initialize the logging system. 138 159 * 139 * @param prog_name 160 * @param prog_name Program name, will be printed as part of message 140 161 */ 141 162 int log_init(const char *prog_name) … … 190 211 /** Write an entry to the log. 191 212 * 192 * @param level Message verbosity level. Message is only printed 193 * if verbosity is less than or equal to current 194 * reporting level. 195 * @param fmt Format string (no traling newline). 213 * The message is printed only if the verbosity level is less than or 214 * equal to currently set reporting level of the log. 215 * 216 * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means). 217 * @param level Severity level of the message. 218 * @param fmt Format string in printf-like format (without trailing newline). 196 219 */ 197 220 void log_msg(log_t ctx, log_level_t level, const char *fmt, ...) … … 206 229 /** Write an entry to the log (va_list variant). 207 230 * 208 * @param level Message verbosity level. Message is only printed209 * if verbosity is less than or equal to current210 * reporting level.211 * @param fmt Format string (no trailing newline)231 * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means). 232 * @param level Severity level of the message. 233 * @param fmt Format string in printf-like format (without trailing newline). 234 * @param args Arguments. 212 235 */ 213 236 void log_msgv(log_t ctx, log_level_t level, const char *fmt, va_list args) -
uspace/lib/c/generic/io/logctl.c
r70253688 re0c836e8 65 65 } 66 66 67 67 /** Set default reported log level (global setting). 68 * 69 * This setting affects all logger clients whose reporting level was 70 * not yet changed. 71 * 72 * If logging level of client A is changed with logctl_set_log_level() 73 * to some level, this call will have no effect at that client's reporting 74 * level. Even if the actual value of the reporting level of client A is 75 * the same as current (previous) default log level. 76 * 77 * @param new_level New reported logging level. 78 * @return Error code of the conversion or EOK on success. 79 */ 68 80 int logctl_set_default_level(log_level_t new_level) 69 81 { … … 81 93 } 82 94 95 /** Set reported log level of a single log. 96 * 97 * @see logctl_set_default_level 98 * 99 * @param logname Log name. 100 * @param new_level New reported logging level. 101 * @return Error code of the conversion or EOK on success. 102 */ 83 103 int logctl_set_log_level(const char *logname, log_level_t new_level) 84 104 { -
uspace/lib/c/include/io/log.h
r70253688 re0c836e8 39 39 #include <io/verify.h> 40 40 41 /** Log message level. */ 41 42 typedef enum { 43 /** Fatal error, program is not able to recover at all. */ 42 44 LVL_FATAL, 45 /** Serious error but the program can recover from it. */ 43 46 LVL_ERROR, 47 /** Easily recoverable problem. */ 44 48 LVL_WARN, 49 /** Information message that ought to be printed by default. */ 45 50 LVL_NOTE, 51 /** Debugging purpose message. */ 46 52 LVL_DEBUG, 53 /** More detailed debugging message. */ 47 54 LVL_DEBUG2, 48 55 … … 51 58 } log_level_t; 52 59 60 /** Log itself (logging target). */ 53 61 typedef sysarg_t log_t; 62 /** Formatting directive for printing log_t. */ 54 63 #define PRIlogctx PRIxn 64 65 /** Default log (target). */ 55 66 #define LOG_DEFAULT ((log_t) -1) 67 68 /** Use when creating new top-level log. */ 56 69 #define LOG_NO_PARENT ((log_t) 0) 57 70
Note:
See TracChangeset
for help on using the changeset viewer.