summaryrefslogtreecommitdiffstats
path: root/lib/libUPnP/Neptune/Source/System/Apple/NptAppleLogConfig.mm
blob: d050f38f565359e4092627e6b0946f3e29e4f703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*****************************************************************
|
|      Neptune - System Log Config
|
|      (c) 2001-2008 Gilles Boccon-Gibod
|      Author: Gilles Boccon-Gibod (bok@bok.net)
|
****************************************************************/

#import <Foundation/Foundation.h>

#import "NptAutoreleasePool.h"
#import "NptLogging.h"

NPT_Result
NPT_GetSystemLogConfig(NPT_String& config)
{
	NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
	NSDictionary* env_vars = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"LSEnvironment"];
	NSString* npt_log_config = [env_vars objectForKey:@"NEPTUNE_LOG_CONFIG"];
#else
	NSString *npt_log_config = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NEPTUNE_LOG_CONFIG"];
#endif

	NPT_Result result = NPT_SUCCESS;
	if (npt_log_config) {
		NSLog(@"NEPTUNE_LOG_CONFIG in plist is: %@", npt_log_config);
		config = (const char*)[npt_log_config UTF8String];
	} else {
		NSLog(@"NEPTUNE_LOG_CONFIG not found in 'Info.plist'");
		result = NPT_ERROR_NO_SUCH_PROPERTY;
	}

	[pool release];
	return result;
}