Changeset e0c836e8 in mainline for uspace/lib/c/generic/io
- Timestamp:
- 2012-09-07T08:29:43Z (13 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/generic/io
- Files:
-
- 2 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 Program name, will be printed as part of message160 * @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 {
Note:
See TracChangeset
for help on using the changeset viewer.
