nxt_log.c (564:762f8c976ead) nxt_log.c (704:1fcac04f0a15)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 78 unchanged lines hidden (view full) ---

87 va_start(args, fmt);
88 p = nxt_vsprintf(p, end, fmt, args);
89 va_end(args);
90
91 if (level != NXT_LOG_DEBUG && log->ctx_handler != NULL) {
92 p = log->ctx_handler(log->ctx, p, end);
93 }
94
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 78 unchanged lines hidden (view full) ---

87 va_start(args, fmt);
88 p = nxt_vsprintf(p, end, fmt, args);
89 va_end(args);
90
91 if (level != NXT_LOG_DEBUG && log->ctx_handler != NULL) {
92 p = log->ctx_handler(log->ctx, p, end);
93 }
94
95 if (p > end - NXT_LINEFEED_SIZE) {
96 p = end - NXT_LINEFEED_SIZE;
95 if (p > end - nxt_length("\n")) {
96 p = end - nxt_length("\n");
97 }
98
97 }
98
99 nxt_linefeed(p);
99 *p++ = '\n';
100
101 (void) nxt_write_console(nxt_stderr, msg, p - msg);
102
103 if (level == NXT_LOG_ALERT) {
100
101 (void) nxt_write_console(nxt_stderr, msg, p - msg);
102
103 if (level == NXT_LOG_ALERT) {
104 *(p - NXT_LINEFEED_SIZE) = '\0';
104 *(p - nxt_length("\n")) = '\0';
105
106 /*
107 * Syslog LOG_ALERT level is enough, because
108 * LOG_EMERG level broadcast a message to all users.
109 */
110 nxt_write_syslog(LOG_ALERT, syslogmsg);
111 }
112}
105
106 /*
107 * Syslog LOG_ALERT level is enough, because
108 * LOG_EMERG level broadcast a message to all users.
109 */
110 nxt_write_syslog(LOG_ALERT, syslogmsg);
111 }
112}