コード例 #1
0
/* write something to the log file and syslog facility */
static void write_to_all_logs_with_timestamp(char *buffer, unsigned long data_type, time_t *timestamp) {
    /* write to syslog */
    write_to_syslog(buffer, data_type);

    /* write to main log */
    write_to_log(buffer, data_type, timestamp);
}
コード例 #2
0
ファイル: logging.c プロジェクト: mattbostock/icinga-core
/* write something to the log file and syslog facility */
static void write_to_all_logs_with_timestamp_with_host_service(char *buffer, unsigned long data_type, time_t *timestamp, host *hst, service *svc) {

	/* write to syslog */
	write_to_syslog(buffer, data_type);

	/* write to main log */
	write_to_log_with_host_service(buffer, data_type, timestamp, hst, svc);
}
コード例 #3
0
/* write something to the log file and syslog facility */
int write_to_all_logs(char *buffer, unsigned long data_type) {

    /* write to syslog */
    write_to_syslog(buffer, data_type);

    /* write to main log */
    write_to_log(buffer, data_type, NULL);

    return OK;
}
コード例 #4
0
ファイル: logging.c プロジェクト: mattbostock/icinga-core
int write_to_all_logs_with_host_service(char *buffer, unsigned long data_type, host *hst, service *svc) {

	/* write to syslog */
	write_to_syslog(buffer, data_type);

	/* write to main log */
	write_to_log_with_host_service(buffer, data_type, NULL, hst, svc);

	return OK;
}
コード例 #5
0
ファイル: async_syslog.c プロジェクト: cyclefusion/szarp
void async_vsyslog(struct async_syslog_state* state, int priority, const char *format, va_list ap) {
	if (!(state->mask & LOG_MASK(LOG_PRI(priority))) || (priority &~ (LOG_PRIMASK|LOG_FACMASK)))
		return;

	if (state->buffer_get == state->buffer_put && !state->buffers_empty)
		return;

	connect_to_syslog(state);
	add_to_log_buffer(state, priority, format, ap);
	write_to_syslog(state);
}
コード例 #6
0
ファイル: log.c プロジェクト: ChALkeR/systemd
static int log_dispatch(
                int level,
                int error,
                const char *file,
                int line,
                const char *func,
                const char *object_field,
                const char *object,
                char *buffer) {

        assert(buffer);

        if (log_target == LOG_TARGET_NULL)
                return -error;

        /* Patch in LOG_DAEMON facility if necessary */
        if ((level & LOG_FACMASK) == 0)
                level = log_facility | LOG_PRI(level);

        if (error < 0)
                error = -error;

        do {
                char *e;
                int k = 0;

                buffer += strspn(buffer, NEWLINE);

                if (buffer[0] == 0)
                        break;

                if ((e = strpbrk(buffer, NEWLINE)))
                        *(e++) = 0;

                if (log_target == LOG_TARGET_AUTO ||
                    log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                    log_target == LOG_TARGET_JOURNAL) {

                        k = write_to_journal(level, error, file, line, func, object_field, object, buffer);
                        if (k < 0) {
                                if (k != -EAGAIN)
                                        log_close_journal();
                                log_open_kmsg();
                        }
                }

                if (log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                    log_target == LOG_TARGET_SYSLOG) {

                        k = write_to_syslog(level, error, file, line, func, object_field, object, buffer);
                        if (k < 0) {
                                if (k != -EAGAIN)
                                        log_close_syslog();
                                log_open_kmsg();
                        }
                }

                if (k <= 0 &&
                    (log_target == LOG_TARGET_AUTO ||
                     log_target == LOG_TARGET_SAFE ||
                     log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                     log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                     log_target == LOG_TARGET_KMSG)) {

                        k = write_to_kmsg(level, error, file, line, func, object_field, object, buffer);
                        if (k < 0) {
                                log_close_kmsg();
                                log_open_console();
                        }
                }

                if (k <= 0)
                        (void) write_to_console(level, error, file, line, func, object_field, object, buffer);

                buffer = e;
        } while (buffer);

        return -error;
}
コード例 #7
0
ファイル: async_syslog.c プロジェクト: cyclefusion/szarp
static void event_callback(evutil_socket_t fd, short what, void *data) {
	struct async_syslog_state* state = data;
	state->write_ready = 1;
	write_to_syslog(state);
}