diff options
author | Jeremias Stotter <jeremias@stotter.eu> | 2022-04-21 21:03:12 +0200 |
---|---|---|
committer | Jeremias Stotter <jeremias@stotter.eu> | 2022-04-21 21:03:12 +0200 |
commit | 4277409f6bd1a8c9d2ba97dd162f717a80e72a04 (patch) | |
tree | 902e703cb2472b696d918c3c882bd3a21987710f | |
parent | 463fd7d47d56e6f9f4a0e08ac641c862b800a5b5 (diff) | |
download | JBlog-4277409f6bd1a8c9d2ba97dd162f717a80e72a04.tar.gz JBlog-4277409f6bd1a8c9d2ba97dd162f717a80e72a04.tar.bz2 JBlog-4277409f6bd1a8c9d2ba97dd162f717a80e72a04.zip |
Changed the log function a bit
-rw-r--r-- | jblog.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -78,7 +78,6 @@ void jb_log(int loglevel, bool include_errno, char* error_string) { int curr_errno = errno; char error_full[4096] = {0}; char err_prefix[8] = {0}; - FILE* nologfile_out = stdout; switch(loglevel) { case LL_INFO: strcpy(err_prefix, "INFO"); @@ -88,14 +87,12 @@ void jb_log(int loglevel, bool include_errno, char* error_string) { break; case LL_ERR: strcpy(err_prefix, "ERROR"); - nologfile_out = stderr; break; } snprintf(error_full, 4095, "(%ld) %s: %s%s%s\n", time(NULL), err_prefix,error_string, include_errno ? " : " : "", include_errno ? strerror(curr_errno) : "" ); - if(logfile >= 0) { - (void)!write(logfile, error_full, strlen(error_full)); - } - fprintf(nologfile_out, error_full); + (void)!write(logfile > 0 ? logfile : + (loglevel == LL_ERR ? 2 : 1), + error_full, strlen(error_full)); } // Escape a html character |