aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Core/FIRLogger.m
diff options
context:
space:
mode:
authorGravatar Ryan Wilson <wilsonryan@google.com>2017-11-08 10:25:23 -0500
committerGravatar GitHub <noreply@github.com>2017-11-08 10:25:23 -0500
commit2ea4225ed5ddf3ba11e96b34841d94a2ff4e7806 (patch)
tree6364732763df4431a7946f6b065a956d9235be0b /Firebase/Core/FIRLogger.m
parent62f5433813e2a40ed6f664b527b7a4d178730900 (diff)
Add argument for forcing STDERR output in FIRLogger. (#430)
Diffstat (limited to 'Firebase/Core/FIRLogger.m')
-rw-r--r--Firebase/Core/FIRLogger.m8
1 files changed, 7 insertions, 1 deletions
diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m
index a607f58..ba22bde 100644
--- a/Firebase/Core/FIRLogger.m
+++ b/Firebase/Core/FIRLogger.m
@@ -43,6 +43,7 @@ FIRLoggerService kFIRLoggerStorage = @"[Firebase/Storage]";
/// Arguments passed on launch.
NSString *const kFIRDisableDebugModeApplicationArgument = @"-FIRDebugDisabled";
NSString *const kFIREnableDebugModeApplicationArgument = @"-FIRDebugEnabled";
+NSString *const kFIRLoggerForceSDTERRApplicationArgument = @"-FIRLoggerForceSTDERR";
/// Key for the debug mode bit in NSUserDefaults.
NSString *const kFIRPersistedDebugModeKey = @"/google/firebase/debug_mode";
@@ -92,6 +93,12 @@ void FIRLoggerInitializeASL() {
}
#endif // TARGET_OS_SIMULATOR
+ // Override the aslOptions to ASL_OPT_STDERR if the override argument is passed in.
+ NSArray *arguments = [NSProcessInfo processInfo].arguments;
+ if ([arguments containsObject:kFIRLoggerForceSDTERRApplicationArgument]) {
+ aslOptions = ASL_OPT_STDERR;
+ }
+
// Initialize the ASL client handle.
sFIRLoggerClient = asl_open(NULL, kFIRLoggerASLClientFacilityName, aslOptions);
@@ -101,7 +108,6 @@ void FIRLoggerInitializeASL() {
sFIRAnalyticsDebugMode = NO;
sFIRLoggerMaximumLevel = FIRLoggerLevelNotice;
- NSArray *arguments = [NSProcessInfo processInfo].arguments;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
BOOL debugMode = [userDefaults boolForKey:kFIRPersistedDebugModeKey];