24 #include <core/threading/mutex.h> 25 #include <logging/syslog.h> 26 #include <sys/syslog.h> 48 now_s = (struct ::tm *)malloc(
sizeof(struct ::tm));
51 openlog(
"Fawkes", LOG_CONS | LOG_NDELAY, LOG_USER);
60 now_s = (struct ::tm *)malloc(
sizeof(struct ::tm));
64 openlog(
"Fawkes", LOG_CONS | LOG_NDELAY, LOG_USER);
66 ident_ = strdup(ident);
67 openlog(ident_, LOG_CONS | LOG_NDELAY, LOG_USER);
88 if (vasprintf(&message, format, va) != -1) {
89 syslog(LOG_DEBUG,
"%s: %s", component, message);
92 vsyslog(LOG_DEBUG, format, va);
104 if (vasprintf(&message, format, va) != -1) {
105 syslog(LOG_INFO,
"%s: %s", component, message);
108 vsyslog(LOG_INFO, format, va);
120 if (vasprintf(&message, format, va) != -1) {
121 syslog(LOG_WARNING,
"%s: %s", component, message);
124 vsyslog(LOG_WARNING, format, va);
136 if (vasprintf(&message, format, va) != -1) {
137 syslog(LOG_ERR,
"%s: %s", component, message);
140 vsyslog(LOG_ERR, format, va);
150 va_start(arg, format);
159 va_start(arg, format);
168 va_start(arg, format);
177 va_start(arg, format);
188 syslog(LOG_DEBUG,
"%s: [EXC] %s", component, *i);
200 syslog(LOG_INFO,
"%s: [EXC] %s", component, *i);
212 syslog(LOG_WARNING,
"%s: [EXC] %s", component, *i);
224 syslog(LOG_ERR,
"%s: [EXC] %s", component, *i);
234 va_start(arg, format);
243 va_start(arg, format);
252 va_start(arg, format);
261 va_start(arg, format);
271 localtime_r(&t->tv_sec, now_s);
274 "%s @ %02d:%02d:%02d.%06ld: [EXC] %s",
291 localtime_r(&t->tv_sec, now_s);
294 "%s @ %02d:%02d:%02d.%06ld: [EXC] %s",
311 localtime_r(&t->tv_sec, now_s);
314 "%s @ %02d:%02d:%02d.%06ld: [EXC] %s",
331 localtime_r(&t->tv_sec, now_s);
334 "%s @ %02d:%02d:%02d.%06ld: [EXC] %s",
351 localtime_r(&t->tv_sec, now_s);
353 if (vasprintf(&message, format, va) != -1) {
355 "%s @ %02d:%02d:%02d.%06ld: %s",
364 vsyslog(LOG_DEBUG, format, va);
375 localtime_r(&t->tv_sec, now_s);
377 if (vasprintf(&message, format, va) != -1) {
379 "%s @ %02d:%02d:%02d.%06ld: %s",
388 vsyslog(LOG_INFO, format, va);
399 localtime_r(&t->tv_sec, now_s);
401 if (vasprintf(&message, format, va) != -1) {
403 "%s @ %02d:%02d:%02d.%06ld: %s",
412 vsyslog(LOG_WARNING, format, va);
423 localtime_r(&t->tv_sec, now_s);
425 if (vasprintf(&message, format, va) != -1) {
427 "%s @ %02d:%02d:%02d.%06ld: %s",
436 vsyslog(LOG_ERR, format, va);
virtual void log_warn(const char *component, const char *format,...)
Log warning message.
virtual void log_debug(const char *component, const char *format,...)
Log debug message.
virtual void vtlog_error(struct timeval *t, const char *component, const char *format, va_list va)
Log error message for specific time.
LogLevel log_level
Minimum log level.
informational output about normal procedures
virtual void vlog_warn(const char *component, const char *format, va_list va)
Log warning message.
virtual void vtlog_warn(struct timeval *t, const char *component, const char *format, va_list va)
Log warning message for specific time.
virtual void tlog_info(struct timeval *t, const char *component, const char *format,...)
Log informational message for specific time.
Fawkes library namespace.
void unlock()
Unlock the mutex.
warning, should be investigated but software still functions, an example is that something was reques...
virtual void vtlog_debug(struct timeval *t, const char *component, const char *format, va_list va)
Log debug message for specific time.
Message iterator for exceptions.
SyslogLogger(LogLevel log_level=LL_DEBUG)
Constructor.
virtual void vlog_info(const char *component, const char *format, va_list va)
Log informational message.
virtual void tlog_warn(struct timeval *t, const char *component, const char *format,...)
Log warning message for specific time.
error, may be recoverable (software still running) or not (software has to terminate).
iterator end()
Get end iterator for messages.
virtual void vlog_error(const char *component, const char *format, va_list va)
Log error message.
virtual ~SyslogLogger()
Destructor.
Base class for exceptions in Fawkes.
virtual void vlog_debug(const char *component, const char *format, va_list va)
Log debug message.
virtual void log_error(const char *component, const char *format,...)
Log error message.
iterator begin()
Get iterator for messages.
debug output, relevant only when tracking down problems
virtual void tlog_debug(struct timeval *t, const char *component, const char *format,...)
Log debug message for specific time.
virtual void vtlog_info(struct timeval *t, const char *component, const char *format, va_list va)
Log informational message for specific time.
virtual void tlog_error(struct timeval *t, const char *component, const char *format,...)
Log error message for specific time.
void lock()
Lock this mutex.
virtual void log_info(const char *component, const char *format,...)
Log informational message.
Mutex mutual exclusion lock.