Setting log level on backend initialization

Get the current openchange log level (actually is the samba's log level)
This commit is contained in:
Jesús García Sáez
2016-01-25 20:13:21 +01:00
parent aac9cd7c07
commit 3d9466df45
+18
View File
@@ -146,6 +146,8 @@ sogo_backend_init (void)
NSUserDefaults *ud;
SoProductRegistry *registry;
char *argv[] = { SAMBA_PREFIX "/sbin/samba", NULL };
NSString *debugLevel;
uint8_t parentLogLevel;
GSRegisterCurrentThread();
@@ -178,6 +180,22 @@ sogo_backend_init (void)
leakDebugging = YES;
}
/* Set debug level according to samba */
parentLogLevel = DEBUGLEVEL_CLASS[DBGC_ALL]; // FIXME: samba logger specific code
if (parentLogLevel >= 4)
debugLevel = @"DEBUG";
else if (parentLogLevel >= 3)
debugLevel = @"INFO";
else if (parentLogLevel >= 2)
debugLevel = @"WARN";
else if (parentLogLevel >= 1)
debugLevel = @"ERROR";
else
debugLevel = @"FATAL";
OC_DEBUG(3, "[SOGo] Setting log level to %s", [debugLevel UTF8String]);
[ud setObject: debugLevel forKey: @"NGLogDefaultLogLevel"];
[ud synchronize];
registry = [SoProductRegistry sharedProductRegistry];
[registry scanForProductsInDirectory: SOGO_BUNDLES_DIR];