aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-05-21 18:16:27 -0700
committerChris Robinson <[email protected]>2010-05-21 18:16:27 -0700
commit861a933b7b518392920a5723e1a2df71ead4f7e9 (patch)
tree991ed5aaba7df9b11b985f220c94f1d1bef58f2e /Alc/ALc.c
parent58e5404d61757bcc254fe9008defa5a7a71d5138 (diff)
Use the ALSOFT_LOGFILE env var to specify the output for AL_PRINT
Diffstat (limited to 'Alc/ALc.c')
-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)