X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=daemon.h;h=d5583f580e8ec3f2af9456b564e47c13521a4af4;hb=b326b33f0afef8f68623d30fff936d615ce43bc7;hp=ebf32f82f22933d69aefd4204917a9b3352b2edb;hpb=7fbd028fc23846f9f410e3876f5ed92d2d9d5d28;p=paraslash.git diff --git a/daemon.h b/daemon.h index ebf32f82..d5583f58 100644 --- a/daemon.h +++ b/daemon.h @@ -2,11 +2,33 @@ void daemonize(void); -FILE *open_log(const char *logfile_name); -void close_log(FILE* logfile); -void log_welcome(const char *whoami, int loglevel); +void daemon_open_log_or_die(void); +void daemon_close_log(void); +void log_welcome(const char *whoami); void drop_privileges_or_die(const char *username, const char *groupname); /** used for server_uptime() */ -enum uptime {UPTIME_SET, UPTIME_GET}; -time_t server_uptime(enum uptime set_or_get); -__malloc char *uptime_str(void); +void set_server_start_time(const struct timeval *startuptime); +time_t get_server_uptime(const struct timeval *current_time); +__malloc char *get_server_uptime_str(const struct timeval *current_time); +void daemon_set_logfile(char *logfile_name); +void daemon_set_flag(unsigned flag); +void daemon_clear_flag(unsigned flag); +void daemon_set_loglevel(char *loglevel); +void daemon_set_default_log_colors(void); +void daemon_set_log_color_or_die(char const *arg); + +/** Daemon log configuration flags. */ +enum daemon_flags { + /** Whether the hostname should be logged. */ + DF_LOG_HOSTNAME = 1, + /** Whether the PID should be logged. */ + DF_LOG_PID = 2, + /** Prepend log message with date and time. */ + DF_LOG_TIME = 4, + /** Also print the loglevel for each message. */ + DF_LOG_LL = 8, + /** Use colored output. */ + DF_COLOR_LOG = 16, + /** Include milliseconds in log output. */ + DF_LOG_TIMING = 32 +};