Changes in uspace/lib/c/include/io/klog.h [ec85df0:91db0280] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/klog.h
rec85df0 r91db0280 1 1 /* 2 * Copyright (c) 20 06 Jakub Vana2 * Copyright (c) 2013 Martin Sucha 3 3 * All rights reserved. 4 4 * … … 39 39 #include <stdarg.h> 40 40 #include <io/verify.h> 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include <str.h> 44 #include <abi/log.h> 41 45 42 extern size_t klog_write(const void *, size_t); 43 extern void klog_update(void); 44 extern void klog_command(const void *, size_t); 45 extern int klog_printf(const char *, ...) 46 PRINTF_ATTRIBUTE(1, 2); 47 extern int klog_vprintf(const char *, va_list); 46 extern size_t klog_write(log_level_t, const void *, size_t); 47 extern int klog_read(void *, size_t); 48 49 #define KLOG_PRINTF(lvl, fmt, ...) ({ \ 50 char *_fmt = str_dup(fmt); \ 51 size_t _fmtsize = str_size(_fmt); \ 52 if (_fmtsize > 0 && _fmt[_fmtsize - 1] == '\n') \ 53 _fmt[_fmtsize - 1] = 0; \ 54 char *_s; \ 55 int _c = asprintf(&_s, _fmt, ##__VA_ARGS__); \ 56 free(_fmt); \ 57 if (_c >= 0) { \ 58 _c = klog_write((lvl), _s, str_size(_s)); \ 59 free(_s); \ 60 }; \ 61 (_c >= 0); \ 62 }) 48 63 49 64 #endif
Note:
See TracChangeset
for help on using the changeset viewer.