1 /* Copyright (c) 2001, Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2010, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Functions to send messages to log files or the console.
18 #ifdef HAVE_SYS_TIME_H
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
37 #include "container.h"
41 #define TRUNCATED_STR "[...truncated]"
42 #define TRUNCATED_STR_LEN 14
44 /** Information for a single logfile; only used in log.c */
45 typedef struct logfile_t
{
46 struct logfile_t
*next
; /**< Next logfile_t in the linked list. */
47 char *filename
; /**< Filename to open. */
48 int fd
; /**< fd to receive log messages, or -1 for none. */
49 int seems_dead
; /**< Boolean: true if the stream seems to be kaput. */
50 int needs_close
; /**< Boolean: true if the stream gets closed on shutdown. */
51 int is_temporary
; /**< Boolean: close after initializing logging subsystem.*/
52 int is_syslog
; /**< Boolean: send messages to syslog. */
53 log_callback callback
; /**< If not NULL, send messages to this function. */
54 log_severity_list_t
*severities
; /**< Which severity of messages should we
55 * log for each log domain? */
58 static void log_free(logfile_t
*victim
);
60 /** Helper: map a log severity to descriptive string. */
61 static INLINE
const char *
62 sev_to_string(int severity
)
65 case LOG_DEBUG
: return "debug";
66 case LOG_INFO
: return "info";
67 case LOG_NOTICE
: return "notice";
68 case LOG_WARN
: return "warn";
69 case LOG_ERR
: return "err";
70 default: /* Call assert, not tor_assert, since tor_assert
71 * calls log on failure. */
72 assert(0); return "UNKNOWN";
76 /** Helper: decide whether to include the function name in the log message. */
78 should_log_function_name(log_domain_mask_t domain
, int severity
)
83 /* All debugging messages occur in interesting places. */
88 /* We care about places where bugs occur. */
89 return (domain
== LD_BUG
);
91 /* Call assert, not tor_assert, since tor_assert calls log on failure. */
96 /** A mutex to guard changes to logfiles and logging. */
97 static tor_mutex_t log_mutex
;
98 static int log_mutex_initialized
= 0;
100 /** Linked list of logfile_t. */
101 static logfile_t
*logfiles
= NULL
;
103 /** The number of open syslog log handlers that we have. When this reaches 0,
104 * we can close our connection to the syslog facility. */
105 static int syslog_count
= 0;
108 #define LOCK_LOGS() STMT_BEGIN \
109 tor_mutex_acquire(&log_mutex); \
111 #define UNLOCK_LOGS() STMT_BEGIN tor_mutex_release(&log_mutex); STMT_END
113 /** What's the lowest log level anybody cares about? Checking this lets us
114 * bail out early from log_debug if we aren't debugging. */
115 int _log_global_min_severity
= LOG_NOTICE
;
117 static void delete_log(logfile_t
*victim
);
118 static void close_log(logfile_t
*victim
);
120 /** Name of the application: used to generate the message we write at the
121 * start of each new log. */
122 static char *appname
= NULL
;
124 /** Set the "application name" for the logs to <b>name</b>: we'll use this
125 * name in the message we write when starting up, and at the start of each new
128 * Tor uses this string to write the version number to the log file. */
130 log_set_application_name(const char *name
)
133 appname
= name
? tor_strdup(name
) : NULL
;
136 /** Helper: Write the standard prefix for log lines to a
137 * <b>buf_len</b> character buffer in <b>buf</b>.
140 _log_prefix(char *buf
, size_t buf_len
, int severity
)
148 tor_gettimeofday(&now
);
149 t
= (time_t)now
.tv_sec
;
151 n
= strftime(buf
, buf_len
, "%b %d %H:%M:%S", tor_localtime_r(&t
, &tm
));
152 r
= tor_snprintf(buf
+n
, buf_len
-n
, ".%.3i [%s] ",
153 (int)now
.tv_usec
/ 1000, sev_to_string(severity
));
160 /** If lf refers to an actual file that we have just opened, and the file
161 * contains no data, log an "opening new logfile" message at the top.
163 * Return -1 if the log is broken and needs to be deleted, else return 0.
166 log_tor_version(logfile_t
*lf
, int reset
)
172 if (!lf
->needs_close
)
173 /* If it doesn't get closed, it isn't really a file. */
175 if (lf
->is_temporary
)
176 /* If it's temporary, it isn't really a file. */
179 is_new
= lf
->fd
>= 0 && tor_fd_getpos(lf
->fd
) == 0;
181 if (reset
&& !is_new
)
182 /* We are resetting, but we aren't at the start of the file; no
183 * need to log again. */
185 n
= _log_prefix(buf
, sizeof(buf
), LOG_NOTICE
);
187 tor_snprintf(buf
+n
, sizeof(buf
)-n
,
188 "%s opening %slog file.\n", appname
, is_new
?"new ":"");
190 tor_snprintf(buf
+n
, sizeof(buf
)-n
,
191 "Tor %s opening %slog file.\n", VERSION
, is_new
?"new ":"");
193 if (write_all(lf
->fd
, buf
, strlen(buf
), 0) < 0) /* error */
194 return -1; /* failed */
198 /** Helper: Format a log message into a fixed-sized buffer. (This is
199 * factored out of <b>logv</b> so that we never format a message more
200 * than once.) Return a pointer to the first character of the message
201 * portion of the formatted string.
204 format_msg(char *buf
, size_t buf_len
,
205 log_domain_mask_t domain
, int severity
, const char *funcname
,
206 const char *format
, va_list ap
, size_t *msg_len_out
)
212 assert(buf_len
>= 2); /* prevent integer underflow */
213 buf_len
-= 2; /* subtract 2 characters so we have room for \n\0 */
215 n
= _log_prefix(buf
, buf_len
, severity
);
216 end_of_prefix
= buf
+n
;
218 if (funcname
&& should_log_function_name(domain
, severity
)) {
219 r
= tor_snprintf(buf
+n
, buf_len
-n
, "%s(): ", funcname
);
226 if (domain
== LD_BUG
&& buf_len
-n
> 6) {
227 memcpy(buf
+n
, "Bug: ", 6);
231 r
= tor_vsnprintf(buf
+n
,buf_len
-n
,format
,ap
);
233 /* The message was too long; overwrite the end of the buffer with
234 * "[...truncated]" */
235 if (buf_len
>= TRUNCATED_STR_LEN
) {
236 size_t offset
= buf_len
-TRUNCATED_STR_LEN
;
237 /* We have an extra 2 characters after buf_len to hold the \n\0,
238 * so it's safe to add 1 to the size here. */
239 strlcpy(buf
+offset
, TRUNCATED_STR
, buf_len
-offset
+1);
241 /* Set 'n' to the end of the buffer, where we'll be writing \n\0.
242 * Since we already subtracted 2 from buf_len, this is safe.*/
250 return end_of_prefix
;
253 /** Helper: sends a message to the appropriate logfiles, at loglevel
254 * <b>severity</b>. If provided, <b>funcname</b> is prepended to the
255 * message. The actual message is derived as from tor_snprintf(format,ap).
258 logv(int severity
, log_domain_mask_t domain
, const char *funcname
,
259 const char *format
, va_list ap
)
265 char *end_of_prefix
=NULL
;
267 /* Call assert, not tor_assert, since tor_assert calls log on failure. */
269 /* check that severity is sane. Overrunning the masks array leads to
270 * interesting and hard to diagnose effects */
271 assert(severity
>= LOG_ERR
&& severity
<= LOG_DEBUG
);
275 if (! (lf
->severities
->masks
[SEVERITY_MASK_IDX(severity
)] & domain
)) {
279 if (! (lf
->fd
>= 0 || lf
->is_syslog
|| lf
->callback
)) {
283 if (lf
->seems_dead
) {
290 format_msg(buf
, sizeof(buf
), domain
, severity
, funcname
, format
, ap
,
296 char *m
= end_of_prefix
;
298 /* Some syslog implementations have limits on the length of what you can
299 * pass them, and some very old ones do not detect overflow so well.
300 * Regrettably, they call their maximum line length MAXLINE. */
302 #warn "MAXLINE is a very low number; it might not be from syslog.h after all"
304 if (msg_len
>= MAXLINE
)
305 m
= tor_strndup(end_of_prefix
, MAXLINE
-1);
307 syslog(severity
, "%s", m
);
309 if (m
!= end_of_prefix
) {
316 } else if (lf
->callback
) {
317 lf
->callback(severity
, domain
, end_of_prefix
);
321 if (write_all(lf
->fd
, buf
, msg_len
, 0) < 0) { /* error */
322 /* don't log the error! mark this log entry to be blown away, and
331 /** Output a message to the log. */
333 _log(int severity
, log_domain_mask_t domain
, const char *format
, ...)
336 if (severity
> _log_global_min_severity
)
339 logv(severity
, domain
, NULL
, format
, ap
);
343 /** Output a message to the log, prefixed with a function name <b>fn</b>. */
346 _log_fn(int severity
, log_domain_mask_t domain
, const char *fn
,
347 const char *format
, ...)
350 if (severity
> _log_global_min_severity
)
353 logv(severity
, domain
, fn
, format
, ap
);
357 const char *_log_fn_function_name
=NULL
;
359 _log_fn(int severity
, log_domain_mask_t domain
, const char *format
, ...)
362 if (severity
> _log_global_min_severity
)
365 logv(severity
, domain
, _log_fn_function_name
, format
, ap
);
367 _log_fn_function_name
= NULL
;
370 _log_debug(log_domain_mask_t domain
, const char *format
, ...)
373 /* For GCC we do this check in the macro. */
374 if (PREDICT_LIKELY(LOG_DEBUG
> _log_global_min_severity
))
377 logv(LOG_DEBUG
, domain
, _log_fn_function_name
, format
, ap
);
379 _log_fn_function_name
= NULL
;
382 _log_info(log_domain_mask_t domain
, const char *format
, ...)
385 if (LOG_INFO
> _log_global_min_severity
)
388 logv(LOG_INFO
, domain
, _log_fn_function_name
, format
, ap
);
390 _log_fn_function_name
= NULL
;
393 _log_notice(log_domain_mask_t domain
, const char *format
, ...)
396 if (LOG_NOTICE
> _log_global_min_severity
)
399 logv(LOG_NOTICE
, domain
, _log_fn_function_name
, format
, ap
);
401 _log_fn_function_name
= NULL
;
404 _log_warn(log_domain_mask_t domain
, const char *format
, ...)
407 if (LOG_WARN
> _log_global_min_severity
)
410 logv(LOG_WARN
, domain
, _log_fn_function_name
, format
, ap
);
412 _log_fn_function_name
= NULL
;
415 _log_err(log_domain_mask_t domain
, const char *format
, ...)
418 if (LOG_ERR
> _log_global_min_severity
)
421 logv(LOG_ERR
, domain
, _log_fn_function_name
, format
, ap
);
423 _log_fn_function_name
= NULL
;
427 /** Free all storage held by <b>victim</b>. */
429 log_free(logfile_t
*victim
)
431 tor_free(victim
->severities
);
432 tor_free(victim
->filename
);
436 /** Close all open log files, and free other static memory. */
440 logfile_t
*victim
, *next
;
453 /* We _could_ destroy the log mutex here, but that would screw up any logs
454 * that happened between here and the end of execution. */
457 /** Remove and free the log entry <b>victim</b> from the linked-list
458 * logfiles (it is probably present, but it might not be due to thread
459 * racing issues). After this function is called, the caller shouldn't
460 * refer to <b>victim</b> anymore.
462 * Long-term, we need to do something about races in the log subsystem
463 * in general. See bug 222 for more details.
466 delete_log(logfile_t
*victim
)
469 if (victim
== logfiles
)
470 logfiles
= victim
->next
;
472 for (tmpl
= logfiles
; tmpl
&& tmpl
->next
!= victim
; tmpl
=tmpl
->next
) ;
474 // tor_assert(tmpl->next == victim);
477 tmpl
->next
= victim
->next
;
482 /** Helper: release system resources (but not memory) held by a single
485 close_log(logfile_t
*victim
)
487 if (victim
->needs_close
&& victim
->fd
>= 0) {
490 } else if (victim
->is_syslog
) {
492 if (--syslog_count
== 0) {
493 /* There are no other syslogs; close the logging facility. */
500 /** Adjust a log severity configuration in <b>severity_out</b> to contain
501 * every domain between <b>loglevelMin</b> and <b>loglevelMax</b>, inclusive.
504 set_log_severity_config(int loglevelMin
, int loglevelMax
,
505 log_severity_list_t
*severity_out
)
508 tor_assert(loglevelMin
>= loglevelMax
);
509 tor_assert(loglevelMin
>= LOG_ERR
&& loglevelMin
<= LOG_DEBUG
);
510 tor_assert(loglevelMax
>= LOG_ERR
&& loglevelMax
<= LOG_DEBUG
);
511 memset(severity_out
, 0, sizeof(log_severity_list_t
));
512 for (i
= loglevelMin
; i
>= loglevelMax
; --i
) {
513 severity_out
->masks
[SEVERITY_MASK_IDX(i
)] = ~0u;
517 /** Add a log handler named <b>name</b> to send all messages in <b>severity</b>
518 * to <b>fd</b>. Copies <b>severity</b>. Helper: does no locking. */
520 add_stream_log_impl(const log_severity_list_t
*severity
,
521 const char *name
, int fd
)
524 lf
= tor_malloc_zero(sizeof(logfile_t
));
526 lf
->filename
= tor_strdup(name
);
527 lf
->severities
= tor_memdup(severity
, sizeof(log_severity_list_t
));
531 _log_global_min_severity
= get_min_log_level();
534 /** Add a log handler named <b>name</b> to send all messages in <b>severity</b>
535 * to <b>fd</b>. Steals a reference to <b>severity</b>; the caller must
536 * not use it after calling this function. */
538 add_stream_log(const log_severity_list_t
*severity
,
539 const char *name
, int fd
)
542 add_stream_log_impl(severity
, name
, fd
);
546 /** Initialize the global logging facility */
550 if (!log_mutex_initialized
) {
551 tor_mutex_init(&log_mutex
);
552 log_mutex_initialized
= 1;
556 /** Add a log handler to receive messages during startup (before the real
557 * logs are initialized).
560 add_temp_log(int min_severity
)
562 log_severity_list_t
*s
= tor_malloc_zero(sizeof(log_severity_list_t
));
563 set_log_severity_config(min_severity
, LOG_ERR
, s
);
565 add_stream_log_impl(s
, "<temp>", fileno(stdout
));
567 logfiles
->is_temporary
= 1;
572 * Add a log handler to send messages in <b>severity</b>
573 * to the function <b>cb</b>.
576 add_callback_log(const log_severity_list_t
*severity
, log_callback cb
)
579 lf
= tor_malloc_zero(sizeof(logfile_t
));
581 lf
->severities
= tor_memdup(severity
, sizeof(log_severity_list_t
));
582 lf
->filename
= tor_strdup("<callback>");
588 _log_global_min_severity
= get_min_log_level();
593 /** Adjust the configured severity of any logs whose callback function is
596 change_callback_log_severity(int loglevelMin
, int loglevelMax
,
600 log_severity_list_t severities
;
601 set_log_severity_config(loglevelMin
, loglevelMax
, &severities
);
603 for (lf
= logfiles
; lf
; lf
= lf
->next
) {
604 if (lf
->callback
== cb
) {
605 memcpy(lf
->severities
, &severities
, sizeof(severities
));
608 _log_global_min_severity
= get_min_log_level();
612 /** Close any log handlers added by add_temp_log() or marked by
613 * mark_logs_temp(). */
615 close_temp_logs(void)
620 for (p
= &logfiles
; *p
; ) {
621 if ((*p
)->is_temporary
) {
623 /* we use *p here to handle the edge case of the head of the list */
632 _log_global_min_severity
= get_min_log_level();
636 /** Make all currently temporary logs (set to be closed by close_temp_logs)
637 * live again, and close all non-temporary logs. */
639 rollback_log_changes(void)
643 for (lf
= logfiles
; lf
; lf
= lf
->next
)
644 lf
->is_temporary
= ! lf
->is_temporary
;
649 /** Configure all log handles to be closed by close_temp_logs(). */
655 for (lf
= logfiles
; lf
; lf
= lf
->next
)
656 lf
->is_temporary
= 1;
661 * Add a log handler to send messages to <b>filename</b>. If opening the
662 * logfile fails, -1 is returned and errno is set appropriately (by open(2)).
665 add_file_log(const log_severity_list_t
*severity
, const char *filename
)
670 fd
= open(filename
, O_WRONLY
|O_CREAT
|O_APPEND
, 0644);
673 if (tor_fd_seekend(fd
)<0)
677 add_stream_log_impl(severity
, filename
, fd
);
678 logfiles
->needs_close
= 1;
680 _log_global_min_severity
= get_min_log_level();
683 if (log_tor_version(lf
, 0) < 0) {
694 * Add a log handler to send messages to they system log facility.
697 add_syslog_log(const log_severity_list_t
*severity
)
700 if (syslog_count
++ == 0)
701 /* This is the first syslog. */
702 openlog("Tor", LOG_PID
| LOG_NDELAY
, LOGFACILITY
);
704 lf
= tor_malloc_zero(sizeof(logfile_t
));
706 lf
->severities
= tor_memdup(severity
, sizeof(log_severity_list_t
));
707 lf
->filename
= tor_strdup("<syslog>");
714 _log_global_min_severity
= get_min_log_level();
720 /** If <b>level</b> is a valid log severity, return the corresponding
721 * numeric value. Otherwise, return -1. */
723 parse_log_level(const char *level
)
725 if (!strcasecmp(level
, "err"))
727 if (!strcasecmp(level
, "warn"))
729 if (!strcasecmp(level
, "notice"))
731 if (!strcasecmp(level
, "info"))
733 if (!strcasecmp(level
, "debug"))
738 /** Return the string equivalent of a given log level. */
740 log_level_to_string(int level
)
742 return sev_to_string(level
);
745 /** NULL-terminated array of names for log domains such that domain_list[dom]
746 * is a description of <b>dom</b>. */
747 static const char *domain_list
[] = {
748 "GENERAL", "CRYPTO", "NET", "CONFIG", "FS", "PROTOCOL", "MM",
749 "HTTP", "APP", "CONTROL", "CIRC", "REND", "BUG", "DIR", "DIRSERV",
750 "OR", "EDGE", "ACCT", "HIST", NULL
753 /** Return a bitmask for the log domain for which <b>domain</b> is the name,
754 * or 0 if there is no such name. */
755 static log_domain_mask_t
756 parse_log_domain(const char *domain
)
759 for (i
=0; domain_list
[i
]; ++i
) {
760 if (!strcasecmp(domain
, domain_list
[i
]))
766 /** Translate a bitmask of log domains to a string, or NULL if the bitmask
769 domain_to_string(log_domain_mask_t domain
)
771 int bit
= tor_log2(domain
);
772 if ((bit
== 0 && domain
== 0) || bit
>= N_LOGGING_DOMAINS
)
774 return domain_list
[bit
];
778 /** Parse a log severity pattern in *<b>cfg_ptr</b>. Advance cfg_ptr after
779 * the end of the severityPattern. Set the value of <b>severity_out</b> to
780 * the parsed pattern. Return 0 on success, -1 on failure.
782 * The syntax for a SeverityPattern is:
784 * SeverityPattern = *(DomainSeverity SP)* DomainSeverity
785 * DomainSeverity = (DomainList SP)? SeverityRange
786 * SeverityRange = MinSeverity ("-" MaxSeverity )?
787 * DomainList = "[" (SP? DomainSpec SP? ",") SP? DomainSpec "]"
788 * DomainSpec = "*" | Domain | "~" Domain
790 * A missing MaxSeverity defaults to ERR. Severities and domains are
791 * case-insensitive. "~" indicates negation for a domain; negation happens
792 * last inside a DomainList. Only one SeverityRange without a DomainList is
796 parse_log_severity_config(const char **cfg_ptr
,
797 log_severity_list_t
*severity_out
)
799 const char *cfg
= *cfg_ptr
;
800 int got_anything
= 0;
801 int got_an_unqualified_range
= 0;
802 memset(severity_out
, 0, sizeof(*severity_out
));
804 cfg
= eat_whitespace(cfg
);
806 const char *dash
, *space
;
807 char *sev_lo
, *sev_hi
;
809 log_domain_mask_t domains
= ~0u;
814 smartlist_t
*domains_list
;
815 log_domain_mask_t neg_domains
= 0;
816 const char *closebracket
= strchr(cfg
, ']');
820 domains_str
= tor_strndup(cfg
+1, closebracket
-cfg
-1);
821 domains_list
= smartlist_create();
822 smartlist_split_string(domains_list
, domains_str
, ",", SPLIT_SKIP_SPACE
,
824 tor_free(domains_str
);
825 SMARTLIST_FOREACH(domains_list
, const char *, domain
,
827 if (!strcmp(domain
, "*")) {
832 if (*domain
== '~') {
836 d
= parse_log_domain(domain
);
838 log_warn(LD_CONFIG
, "No such logging domain as %s", domain
);
848 SMARTLIST_FOREACH(domains_list
, char *, d
, tor_free(d
));
849 smartlist_free(domains_list
);
852 domains
&= ~neg_domains
;
853 cfg
= eat_whitespace(closebracket
+1);
855 ++got_an_unqualified_range
;
857 if (!strcasecmpstart(cfg
, "file") ||
858 !strcasecmpstart(cfg
, "stderr") ||
859 !strcasecmpstart(cfg
, "stdout") ||
860 !strcasecmpstart(cfg
, "syslog")) {
863 if (got_an_unqualified_range
> 1)
866 space
= strchr(cfg
, ' ');
867 dash
= strchr(cfg
, '-');
869 space
= strchr(cfg
, '\0');
870 if (dash
&& dash
< space
) {
871 sev_lo
= tor_strndup(cfg
, dash
-cfg
);
872 sev_hi
= tor_strndup(dash
+1, space
-(dash
+1));
874 sev_lo
= tor_strndup(cfg
, space
-cfg
);
875 sev_hi
= tor_strdup("ERR");
877 low
= parse_log_level(sev_lo
);
878 high
= parse_log_level(sev_hi
);
887 for (i
=low
; i
>= high
; --i
)
888 severity_out
->masks
[SEVERITY_MASK_IDX(i
)] |= domains
;
890 cfg
= eat_whitespace(space
);
895 return got_anything
? 0 : -1;
898 /** Return the least severe log level that any current log is interested in. */
900 get_min_log_level(void)
905 for (lf
= logfiles
; lf
; lf
= lf
->next
) {
906 for (i
= LOG_DEBUG
; i
> min
; --i
)
907 if (lf
->severities
->masks
[SEVERITY_MASK_IDX(i
)])
913 /** Switch all logs to output at most verbose level. */
915 switch_logs_debug(void)
920 for (lf
= logfiles
; lf
; lf
=lf
->next
) {
921 for (i
= LOG_DEBUG
; i
>= LOG_ERR
; --i
)
922 lf
->severities
->masks
[SEVERITY_MASK_IDX(i
)] = ~0u;
924 _log_global_min_severity
= get_min_log_level();
928 #ifdef HAVE_EVENT_SET_LOG_CALLBACK
929 /** A string which, if it appears in a libevent log, should be ignored. */
930 static const char *suppress_msg
= NULL
;
931 /** Callback function passed to event_set_log() so we can intercept
932 * log messages from libevent. */
934 libevent_logging_callback(int severity
, const char *msg
)
938 if (suppress_msg
&& strstr(msg
, suppress_msg
))
940 n
= strlcpy(buf
, msg
, sizeof(buf
));
941 if (n
&& n
< sizeof(buf
) && buf
[n
-1] == '\n') {
945 case _EVENT_LOG_DEBUG
:
946 log(LOG_DEBUG
, LD_NET
, "Message from libevent: %s", buf
);
949 log(LOG_INFO
, LD_NET
, "Message from libevent: %s", buf
);
951 case _EVENT_LOG_WARN
:
952 log(LOG_WARN
, LD_GENERAL
, "Warning from libevent: %s", buf
);
955 log(LOG_ERR
, LD_GENERAL
, "Error from libevent: %s", buf
);
958 log(LOG_WARN
, LD_GENERAL
, "Message [%d] from libevent: %s",
963 /** Set hook to intercept log messages from libevent. */
965 configure_libevent_logging(void)
967 event_set_log_callback(libevent_logging_callback
);
969 /** Ignore any libevent log message that contains <b>msg</b>. */
971 suppress_libevent_log_msg(const char *msg
)
977 configure_libevent_logging(void)
981 suppress_libevent_log_msg(const char *msg
)
989 dump_log_info(logfile_t
*lf
)
994 printf("=== log into \"%s\" (%s-%s) (%stemporary)\n", lf
->filename
,
995 sev_to_string(lf
->min_loglevel
),
996 sev_to_string(lf
->max_loglevel
),
997 lf
->is_temporary
?"":"not ");
998 } else if (lf
->is_syslog
) {
999 printf("=== syslog (%s-%s) (%stemporary)\n",
1000 sev_to_string(lf
->min_loglevel
),
1001 sev_to_string(lf
->max_loglevel
),
1002 lf
->is_temporary
?"":"not ");
1004 printf("=== log (%s-%s) (%stemporary)\n",
1005 sev_to_string(lf
->min_loglevel
),
1006 sev_to_string(lf
->max_loglevel
),
1007 lf
->is_temporary
?"":"not ");
1015 printf("==== BEGIN LOGS ====\n");
1016 for (lf
= logfiles
; lf
; lf
= lf
->next
)
1018 printf("==== END LOGS ====\n");