24 #include <logging/factory.h>
25 #include <logging/console.h>
26 #include <logging/file.h>
27 #include <logging/syslog.h>
28 #include <logging/multi.h>
82 if ( strcmp(type,
"console") == 0 ) {
85 }
else if ( strcmp(type,
"file") == 0 ) {
86 char *tmp = strdup(as);
88 char *r = strtok_r(tmp,
":", &saveptr);
89 const char *file_name;
90 r = strtok_r(tmp,
":", &saveptr);
92 file_name =
"unnamed.log";
98 }
else if ( strcmp(type,
"syslog") == 0 ) {
125 char *logger_string = strdup(as);
126 char *str = logger_string;
128 const char *type, *args;
129 char *typeargs_saveptr;
130 const char *logger_delim =
";";
131 const char *logger_typeargs_delim =
":";
132 while ((r = strtok_r(str, logger_delim, &saveptr)) != NULL ) {
133 type = strtok_r(r, logger_typeargs_delim, &typeargs_saveptr);
134 args = strtok_r(NULL, logger_typeargs_delim, &typeargs_saveptr);
135 if ( type == NULL ) {
138 if ( args == NULL ) {
146 e.
append(
"Could not open logger '%s:%s'", type, args);
static MultiLogger * multilogger_instance(const char *as)
Create MultiLogger instance.
Interface for logging to a specified file.
Interface for logging to stderr.
Fawkes library namespace.
static Logger * instance(const char *type, const char *as)
Get logger instance.
Unknown logger type exception.
Log through multiple loggers.
Base class for exceptions in Fawkes.
void add_logger(Logger *logger)
Add a logger.
Interface for logging to syslog.
UnknownLoggerTypeException(const char *msg=NULL)
Constructor.
void append(const char *format,...)
Append messages to the message list.