aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index ae568b2b..c76fe1ac 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -365,6 +365,9 @@ static ALint RTPrioLevel;
// Resampler Quality
resampler_t DefaultResampler;
+// Output Log File
+static FILE *LogFile;
+
///////////////////////////////////////////////////////
@@ -410,6 +413,16 @@ static void alc_init(void)
tls_create(&LocalContext);
+ str = getenv("ALSOFT_LOGFILE");
+ if(str && str[0])
+ {
+ LogFile = fopen(str, "w");
+ if(!LogFile)
+ fprintf(stderr, "AL lib: Failed to open log file '%s'\n", str);
+ }
+ if(!LogFile)
+ LogFile = stderr;
+
RTPrioLevel = GetConfigValueInt(NULL, "rt-prio", 0);
DefaultResampler = GetConfigValueInt(NULL, "resampler", RESAMPLER_DEFAULT);
@@ -512,6 +525,10 @@ static void alc_deinit(void)
for(i = 0;BackendList[i].Deinit;i++)
BackendList[i].Deinit();
+ if(LogFile != stderr)
+ fclose(LogFile);
+ LogFile = NULL;
+
tls_delete(LocalContext);
FreeALConfig();
@@ -601,7 +618,8 @@ void al_print(const char *fname, unsigned int line, const char *fmt, ...)
}
str[sizeof(str)-1] = 0;
- fprintf(stderr, "%s", str);
+ fprintf(LogFile, "%s", str);
+ fflush(LogFile);
}
void SetRTPriority(void)