44
55#include <stdio.h>
66#include <glib/gstdio.h>
7+
8+ #ifndef WIN32
9+ #ifdef SEAFILE_SERVER
710#include <sys/syslog.h>
11+ #endif
12+ #endif
813
914#include "log.h"
1015#include "utils.h"
@@ -14,8 +19,15 @@ static int ccnet_log_level;
1419static int seafile_log_level ;
1520static char * logfile ;
1621static FILE * logfp ;
22+
23+ #ifndef WIN32
24+ #ifdef SEAFILE_SERVER
1725static gboolean enable_syslog ;
26+ #endif
27+ #endif
1828
29+ #ifndef WIN32
30+ #ifdef SEAFILE_SERVER
1931static int
2032get_syslog_level (GLogLevelFlags level )
2133{
@@ -32,6 +44,8 @@ get_syslog_level (GLogLevelFlags level)
3244 return LOG_DEBUG ;
3345 }
3446}
47+ #endif
48+ #endif
3549
3650static void
3751seafile_log (const gchar * log_domain , GLogLevelFlags log_level ,
@@ -57,8 +71,12 @@ seafile_log (const gchar *log_domain, GLogLevelFlags log_level,
5771 printf ("%s %s" , buf , message );
5872 }
5973
74+ #ifndef WIN32
75+ #ifdef SEAFILE_SERVER
6076 if (enable_syslog )
6177 syslog (get_syslog_level (log_level ), "%s" , message );
78+ #endif
79+ #endif
6280}
6381
6482static void
@@ -85,8 +103,12 @@ ccnet_log (const gchar *log_domain, GLogLevelFlags log_level,
85103 printf ("%s %s" , buf , message );
86104 }
87105
106+ #ifndef WIN32
107+ #ifdef SEAFILE_SERVER
88108 if (enable_syslog )
89109 syslog (get_syslog_level (log_level ), "%s" , message );
110+ #endif
111+ #endif
90112}
91113
92114static int
@@ -199,6 +221,8 @@ seafile_debug_impl (SeafileDebugFlags flag, const gchar *format, ...)
199221 }
200222}
201223
224+ #ifndef WIN32
225+ #ifdef SEAFILE_SERVER
202226void
203227set_syslog_config (GKeyFile * config )
204228{
@@ -208,3 +232,5 @@ set_syslog_config (GKeyFile *config)
208232 if (enable_syslog )
209233 openlog (NULL , LOG_NDELAY | LOG_PID , LOG_USER );
210234}
235+ #endif
236+ #endif
0 commit comments