server: log to syslog and stderr

As a daemon, let's log to syslog (and stderr).

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent b30811f86c
commit 31edb3caf0
  1. 3
      server/main.c
  2. 13
      server/render_common.c
  3. 3
      server/render_common.h

@ -27,8 +27,9 @@
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
struct render_context_args ctx_args; render_log_init();
struct render_context_args ctx_args;
bool ok = render_server_main(argc, argv, &ctx_args); bool ok = render_server_main(argc, argv, &ctx_args);
/* this is a subprocess */ /* this is a subprocess */

@ -7,6 +7,13 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <syslog.h>
void
render_log_init(void)
{
openlog(NULL, LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);
}
void void
render_log(const char *fmt, ...) render_log(const char *fmt, ...)
@ -14,10 +21,6 @@ render_log(const char *fmt, ...)
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
vsyslog(LOG_DEBUG, fmt, va);
fprintf(stderr, "render: ");
vfprintf(stderr, fmt, va);
fprintf(stderr, "\n");
va_end(va); va_end(va);
} }

@ -29,6 +29,9 @@ struct render_virgl;
struct render_worker; struct render_worker;
struct render_worker_jail; struct render_worker_jail;
void
render_log_init(void);
void void
render_log(const char *fmt, ...); render_log(const char *fmt, ...);

Loading…
Cancel
Save