tkernel_2/lib/libsys/src/syslog.c | bare source | permlink (0.02 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by T-Engine Forum at 2013/02/28. 11: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 12: * 13: *---------------------------------------------------------------------- 14: */ 15: 16: /* 17: * syslog.c (libsys) 18: */ 19: 20: #include <stdarg.h> 21: #include <sys/syslog.h> 22: 23: extern int tm_vsprintf(char *str, const char *format, va_list ap); 24: extern int __logmask; 25: 26: void syslog( int priority, const char *format, ... ) 27: { 28: va_list ap; 29: char buf[256]; 30: int len; 31: 32: if ( (LOG_MASK(priority & LOG_PRIMASK) & __logmask) != 0 ) { 33: va_start(ap, format); 34: len = tm_vsprintf(buf, format, ap); 35: va_end(ap); 36: if ( len >= sizeof(buf) ) len = sizeof(buf) - 1; 37: if ( len > 0 ) _syslog_send(buf, len); 38: } 39: }