Changeset fc51296 in mainline for uspace/lib
- Timestamp:
- 2011-03-31T17:37:25Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3acb285a
- Parents:
- 9b415c9
- Location:
- uspace/lib
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/log.c
r9b415c9 rfc51296 35 35 #include <errno.h> 36 36 #include <fibril_synch.h> 37 #include <stdarg.h> 37 38 #include <stdlib.h> 38 39 #include <stdio.h> … … 89 90 va_list args; 90 91 92 va_start(args, fmt); 93 log_msgv(level, fmt, args); 94 va_end(args); 95 } 96 97 /** Write an entry to the log (va_list variant). 98 * 99 * @param level Message verbosity level. Message is only printed 100 * if verbosity is less than or equal to current 101 * reporting level. 102 * @param fmt Format string 103 */ 104 void log_msgv(log_level_t level, const char *fmt, va_list args) 105 { 91 106 assert(level < LVL_LIMIT); 92 107 93 108 /* Higher number means higher verbosity. */ 94 109 if (level <= log_level) { 95 va_start(args, fmt);96 110 fibril_mutex_lock(&log_serializer); 97 111 98 fprintf(log_stream, "%s: %s ", log_prog_name,112 fprintf(log_stream, "%s: %s: ", log_prog_name, 99 113 log_level_names[level]); 100 114 vfprintf(log_stream, fmt, args); … … 102 116 103 117 fibril_mutex_unlock(&log_serializer); 104 va_end(args);105 118 } 106 119 } -
uspace/lib/c/include/io/log.h
r9b415c9 rfc51296 35 35 #define LIBC_IO_LOG_H_ 36 36 37 #include <stdarg.h> 38 37 39 typedef enum { 38 40 LVL_FATAL, … … 49 51 extern int log_init(const char *, log_level_t); 50 52 extern void log_msg(log_level_t, const char *, ...); 53 extern void log_msgv(log_level_t, const char *, va_list); 51 54 52 55 #endif -
uspace/lib/drv/Makefile
r9b415c9 rfc51296 35 35 generic/driver.c \ 36 36 generic/dev_iface.c \ 37 generic/log.c \ 37 38 generic/remote_hw_res.c \ 38 39 generic/remote_char_dev.c -
uspace/lib/drv/generic/driver.c
r9b415c9 rfc51296 273 273 274 274 res = driver->driver_ops->add_device(dev); 275 if (res == EOK) { 276 printf("%s: new device with handle=%" PRIun " was added.\n", 277 driver->name, dev_handle); 278 } else { 279 printf("%s: failed to add a new device with handle = %" PRIun ".\n", 280 driver->name, dev_handle); 275 if (res != EOK) 281 276 delete_device(dev); 282 }283 277 284 278 async_answer_0(iid, res);
Note:
See TracChangeset
for help on using the changeset viewer.