Logger
Log levelLog redirection
Set the log level
The logger manager provides 3 levels of logging, depending on what kind of environment you are using.
- Android
- iOS & tvOS
- Web
// Set basic log level (initialization, sessions information, errors), to be used for beta environment
LoggerManager.getInstance().setLogLevel(0);
// Set verbose log level (by default, player events, metrics), to be used for development environment
LoggerManager.getInstance().setLogLevel(1);
// Disable log, to be used for production environment
LoggerManager.getInstance().setLogLevel(-1);
// Set basic log level (initialization, sessions information, errors), to be used for beta environment
[[LoggerManager sharedManager] setLogLevel:BPLogLevelBasic];
// Set verbose log level (by default, player events, metrics), to be used for development environment
[[LoggerManager sharedManager] setLogLevel:BPLogLevelVerbose];
// Disable log, to be used for production environment
[[LoggerManager sharedManager] setLogLevel:BPLogLevelNone];
// Import LoggerManager
const LoggerManager = require('@broadpeak/smartlib').LoggerManager;
// Set basic log level (initialization, sessions information, errors), to be used for beta environment
LoggerManager.getInstance().setLogLevel(0);
// Set verbose log level (by default, player events, metrics), to be used for development environment
LoggerManager.getInstance().setLogLevel(1);
// Disable log, to be used for production environment
LoggerManager.getInstance().setLogLevel(-1);
Redirect the log output
Configure the output to redirect the log output to the system you want. When the redirection is enabled, the default output is disabled.
- Android
- iOS & tvOS
- Web
// Redirect the log output
LoggerManager.getInstance().setLogRedirectListener(log -> {
mMyLogger.add(log);
});
// Create your log redirector implementing the LogRedirectListener protocol
@interface MyLogRedirector : NSObject <LogRedirectListener> {
}
@implementation MyLogRedirector
- (void)onLog:(NSString *)log {
}
@end
...
// Redirect the log output
[[LoggerManager sharedManager] setLogRedirectListener:self];
// Import LoggerManager
const LoggerManager = require('@broadpeak/smartlib').LoggerManager;
// Redirect the log output
LoggerManager.getInstance().setLogRedirectListener({
onLog: log => {
myLogger.add(log);
}
});