Skip to content

Commit

Permalink
Don't compile with syslog support for client and Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
killing committed Apr 29, 2016
1 parent d942428 commit c4e4bdf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

#include <stdio.h>
#include <glib/gstdio.h>

#ifndef WIN32
#ifdef SEAFILE_SERVER
#include <sys/syslog.h>
#endif
#endif

#include "log.h"
#include "utils.h"
Expand All @@ -14,8 +19,15 @@ static int ccnet_log_level;
static int seafile_log_level;
static char *logfile;
static FILE *logfp;

#ifndef WIN32
#ifdef SEAFILE_SERVER
static gboolean enable_syslog;
#endif
#endif

#ifndef WIN32
#ifdef SEAFILE_SERVER
static int
get_syslog_level (GLogLevelFlags level)
{
Expand All @@ -32,6 +44,8 @@ get_syslog_level (GLogLevelFlags level)
return LOG_DEBUG;
}
}
#endif
#endif

static void
seafile_log (const gchar *log_domain, GLogLevelFlags log_level,
Expand All @@ -57,8 +71,12 @@ seafile_log (const gchar *log_domain, GLogLevelFlags log_level,
printf("%s %s", buf, message);
}

#ifndef WIN32
#ifdef SEAFILE_SERVER
if (enable_syslog)
syslog (get_syslog_level (log_level), "%s", message);
#endif
#endif
}

static void
Expand All @@ -85,8 +103,12 @@ ccnet_log (const gchar *log_domain, GLogLevelFlags log_level,
printf("%s %s", buf, message);
}

#ifndef WIN32
#ifdef SEAFILE_SERVER
if (enable_syslog)
syslog (get_syslog_level (log_level), "%s", message);
#endif
#endif
}

static int
Expand Down Expand Up @@ -199,6 +221,8 @@ seafile_debug_impl (SeafileDebugFlags flag, const gchar *format, ...)
}
}

#ifndef WIN32
#ifdef SEAFILE_SERVER
void
set_syslog_config (GKeyFile *config)
{
Expand All @@ -208,3 +232,5 @@ set_syslog_config (GKeyFile *config)
if (enable_syslog)
openlog (NULL, LOG_NDELAY | LOG_PID, LOG_USER);
}
#endif
#endif
4 changes: 4 additions & 0 deletions common/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ int seafile_log_init (const char *logfile, const char *ccnet_debug_level_str,
const char *seafile_debug_level_str);
int seafile_log_reopen ();

#ifndef WIN32
#ifdef SEAFILE_SERVER
void
set_syslog_config (GKeyFile *config);
#endif
#endif

void
seafile_debug_set_flags_string (const gchar *flags_string);
Expand Down
1 change: 1 addition & 0 deletions controller/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
bin_PROGRAMS = seafile-controller

AM_CFLAGS = \
-DSEAFILE_SERVER \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib \
-I$(top_builddir)/lib \
Expand Down

0 comments on commit c4e4bdf

Please sign in to comment.