summaryrefslogtreecommitdiffstats
path: root/eurephiadm/eurephiadm.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-24 00:16:53 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-24 00:16:53 +0200
commit7ae9a74c9c3bdab619ac5c0cefe1c8269bb06603 (patch)
treed4e9a61bd62b18dc37e9caabaa2d63ccc56db627 /eurephiadm/eurephiadm.c
parent9a2a8c5216d61dafb4232dba1ab56656390b61b0 (diff)
downloadeurephia-7ae9a74c9c3bdab619ac5c0cefe1c8269bb06603.tar.gz
eurephia-7ae9a74c9c3bdab619ac5c0cefe1c8269bb06603.tar.xz
eurephia-7ae9a74c9c3bdab619ac5c0cefe1c8269bb06603.zip
Rewritten the eurephia_log() to support syslog logging as well
Also simplified the initialisation of the logging module. By calling the eurephia_log_init(eurephiaCTX *, char *dest, int loglevel) function, a log context will be setup inside the eurephiaCTX. To close the log file, eurephia_log_close(eurephiaCTX *) must be called. The destination string to eurephia_log_init() can be: - stdout: Log everything to stdout - stderr: Log everything to stderr - none: Do no logging at all - syslog:<facility> Log via syslog. <facility> can be: user, local[0-7], daemon or authpriv. - Filename All logging goes to the given filename. If the filename string is not recognised by any of the reserved words above, it will be handled as a filename.
Diffstat (limited to 'eurephiadm/eurephiadm.c')
-rw-r--r--eurephiadm/eurephiadm.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/eurephiadm/eurephiadm.c b/eurephiadm/eurephiadm.c
index 518f8a5..4209e6a 100644
--- a/eurephiadm/eurephiadm.c
+++ b/eurephiadm/eurephiadm.c
@@ -327,7 +327,7 @@ char *args2string(int argc, char **argv) {
* @return returns 0 on success, otherwise a value > 0
*/
int main(int argc, char **argv) {
- FILE *logfile = NULL;
+ char *logfile = NULL;
int loglevel = 0;
eurephiaCTX *ctx = NULL;
eurephiaSESSION *session = NULL;
@@ -367,11 +367,7 @@ int main(int argc, char **argv) {
return 0;
case 'l':
- if( (logfile = fopen(optargs[0], "wb")) == NULL ) {
- fprintf(stderr, "%s: ERROR :: Could not open log file: %s\n",
- basename(argv[0]), optargs[0]);
- return 0;
- }
+ logfile = optargs[0];
break;
case 'L':