doveadm-log.c revision 4338c7b02e15779efaee5cedd4a355c946d9d4c2
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
c49a19168dab6fda80aee16ad799a8a56d3bc18fTimo Sirainen#define TEST_LOG_MSG_PREFIX "This is Dovecot's "
c0a708fa3f7b8f4fbca32052da5faf7a0125189dTimo Sirainenstatic void cmd_log_test(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
bf72c930996df0691932fb1143f360d260f27a06Timo Sirainen unsigned int i;
02ccba3d3be96444abd15b5254864c9151bbeb30Timo Sirainen master_service->flags |= MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR;
bf72c930996df0691932fb1143f360d260f27a06Timo Sirainen master_service_init_log(master_service, "doveadm: ");
c49a19168dab6fda80aee16ad799a8a56d3bc18fTimo Sirainen for (i = 0; i < LAST_LOG_TYPE; i++) {
c49a19168dab6fda80aee16ad799a8a56d3bc18fTimo Sirainen const char *prefix = failure_log_type_prefixes[i];
c0a708fa3f7b8f4fbca32052da5faf7a0125189dTimo Sirainen /* add timestamp so that syslog won't just write
c0a708fa3f7b8f4fbca32052da5faf7a0125189dTimo Sirainen "repeated message" text */
c0a708fa3f7b8f4fbca32052da5faf7a0125189dTimo Sirainen i_log_type(i, TEST_LOG_MSG_PREFIX"%s log (%u)",
ad004e44be109684521494b5af2ad1da39b8bb27Timo Sirainen (unsigned int)ioloop_time);
ad004e44be109684521494b5af2ad1da39b8bb27Timo Sirainenstatic void cmd_log_reopen(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
c0a708fa3f7b8f4fbca32052da5faf7a0125189dTimo Sirainen /* 1 << enum log_type */
caea325346da6fb1cf503b35a619467a997acbfaTimo Sirainen unsigned int mask;
char *key;
struct dirent *d;
char *key;
unsigned int dir_len;
for (i = 0; i < LAST_LOG_TYPE; i++) {
*type_r = i;
return TRUE;
return FALSE;
const char *line, *p;
int fd;
if (p == NULL)
T_BEGIN {
} T_END;
const char *log_dir;
const char *log_file_path;
for (i = 0; i < LAST_LOG_TYPE; i++) {
if (!found)
void doveadm_register_log_commands(void)