aboutsummaryrefslogtreecommitdiff
path: root/src/logger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/logger.c')
-rw-r--r--src/logger.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/logger.c b/src/logger.c
index c944da8..860311b 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -9,6 +9,7 @@
#include "string.h"
#include "logger.h"
+#include "options.h"
Logger __logger;
@@ -25,10 +26,15 @@ Size logger_init( void )
{
String logfile[512];
+ if( LOG_PATH[0] == '~' ) {
+ snprintf(logfile, 512, "%s/%s", getenv("HOME"), LOG_PATH+1);
+ } else {
+ snprintf(logfile, 512, "%s", LOG_PATH);
+ }
- snprintf(logfile, 512, "%s/%s", getenv("HOME"), ".engine33.log");
-
- __logger.fd = open(logfile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH );
+ __logger.fd = open(logfile,
+ O_CREAT | O_TRUNC | O_WRONLY | O_NOCTTY | O_TTY_INIT,
+ 0644 );
if( __logger.fd < 0 ) {
printf( "Unable to initialize logger. Exiting." );
@@ -44,7 +50,7 @@ Size logger_init( void )
void logger_term( void )
{
- dprintf( __logger.fd, "\r\n\r\nGoodbye!" );
+ logi( "Goodbye!" );
close( __logger.fd );
}