Skip to content

Commit 03c4cfa

Browse files
smilesa-maurice
authored andcommitted
Fix log level mapping on iOS.
This aligns the C++ log levels with the set documented in: https://docs.google.com/document/d/1njyNZtfyADRwKVLh-3ByvfW9MSLGvjnE47guOR5_eE8/edit# This also, moves to the public FIRConfiguration API to configure the log level rather than using the private FIRLogger API. PiperOrigin-RevId: 253299177
1 parent f27ff5b commit 03c4cfa

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

app/src/log_ios.mm

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818

1919
#import <Foundation/Foundation.h>
2020

21-
#import "FIRLoggerLevel.h"
21+
#import "FIRConfiguration.h"
2222

2323
#include <stdarg.h>
2424

25-
// Private API to set the logger level in Firebase/Core/Private/FIRLogger.h.
26-
extern "C" void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel);
27-
2825
namespace firebase {
2926

3027
// Key used in Info.plist to configure the log level before a load of code is executed.
@@ -33,8 +30,10 @@
3330
// Maps C++ to iOS SDK log levels.
3431
static const FIRLoggerLevel kCppToIOSLogLevel[] = {
3532
FIRLoggerLevelDebug, // kLogLevelVerbose = 0,
36-
FIRLoggerLevelDebug, // kLogLevelDebug,
37-
FIRLoggerLevelInfo, // kLogLevelInfo,
33+
// Mapping C++ debug to Obj-C info is intentional.
34+
// Info messages are intended to be shown only for debugging scenarios.
35+
FIRLoggerLevelInfo, // kLogLevelDebug,
36+
FIRLoggerLevelNotice, // kLogLevelInfo,
3837
FIRLoggerLevelWarning, // kLogLevelWarning,
3938
FIRLoggerLevelError, // kLogLevelError,
4039
FIRLoggerLevelError, // kLogLevelAssert,
@@ -50,17 +49,17 @@ void LogInitialize() {
5049
if (log_level_number) {
5150
int log_level_value = log_level_number.intValue;
5251
if (log_level_value >= kLogLevelVerbose && log_level_value <= kLogLevelAssert) {
53-
LogSetLevel(static_cast<LogLevel>(log_level_value));
52+
SetLogLevel(static_cast<LogLevel>(log_level_value));
5453
}
5554
}
5655
// Synchronize the platform logger with the C++ log level.
57-
LogSetPlatformLevel(LogGetLevel());
56+
LogSetPlatformLevel(GetLogLevel());
5857
}
5958

6059
// Set the platform specific SDK log level.
6160
void LogSetPlatformLevel(LogLevel level) {
6261
assert(level < sizeof(kCppToIOSLogLevel) / sizeof(kCppToIOSLogLevel[0]));
63-
FIRSetLoggerLevel(kCppToIOSLogLevel[level]);
62+
[[FIRConfiguration sharedInstance] setLoggerLevel:kCppToIOSLogLevel[level]];
6463
}
6564

6665
// Log a firebase message.

0 commit comments

Comments
 (0)