Skip to content

Commit 1d95755

Browse files
Add some sample logging to the SalesforceFileLoggerTestApp, with and without OSLog enabled
1 parent 0de0419 commit 1d95755

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

libs/SalesforceFileLogger/SalesforceFileLogger.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
CE4CE2E91C0E465B009F6029 /* SalesforceFileLogger.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CE4CE2E11C0E465B009F6029 /* SalesforceFileLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4545
CEA2A8EA2214C1B1009D923B /* CocoaLumberjack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEA2A8C72214C184009D923B /* CocoaLumberjack.framework */; };
4646
CEA2A8EB2214C1B9009D923B /* SalesforceSDKCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEA2A8AC2214C174009D923B /* SalesforceSDKCommon.framework */; };
47+
D291DB6C2E468AAF00AA4B64 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D291DB6B2E468AAF00AA4B64 /* ViewController.m */; };
4748
/* End PBXBuildFile section */
4849

4950
/* Begin PBXContainerItemProxy section */
@@ -168,6 +169,8 @@
168169
CEA2A8B32214C184009D923B /* Lumberjack.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Lumberjack.xcodeproj; path = ../../external/CocoaLumberjack/Lumberjack.xcodeproj; sourceTree = "<group>"; };
169170
CECB662E1C1BB8CB008038AE /* SalesforceFileLogger-Dynamic-iOS-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "SalesforceFileLogger-Dynamic-iOS-Debug.xcconfig"; path = "Configuration/SalesforceFileLogger-Dynamic-iOS-Debug.xcconfig"; sourceTree = "<group>"; };
170171
CECB662F1C1BB8CB008038AE /* SalesforceFileLogger-Dynamic-iOS-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "SalesforceFileLogger-Dynamic-iOS-Release.xcconfig"; path = "Configuration/SalesforceFileLogger-Dynamic-iOS-Release.xcconfig"; sourceTree = "<group>"; };
172+
D291DB6A2E468AAF00AA4B64 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
173+
D291DB6B2E468AAF00AA4B64 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
171174
/* End PBXFileReference section */
172175

173176
/* Begin PBXFrameworksBuildPhase section */
@@ -293,6 +296,8 @@
293296
82EFF30516E8049500A63CDF /* SalesforceFileLoggerTestApp */ = {
294297
isa = PBXGroup;
295298
children = (
299+
D291DB6A2E468AAF00AA4B64 /* ViewController.h */,
300+
D291DB6B2E468AAF00AA4B64 /* ViewController.m */,
296301
4F06AFC31C49A87F00F70798 /* Supporting Files */,
297302
B7282F4C1D8C717200475F79 /* SalesforceFileLoggerTestApp.entitlements */,
298303
82EFF34116E80B6300A63CDF /* Classes */,
@@ -622,6 +627,7 @@
622627
isa = PBXSourcesBuildPhase;
623628
buildActionMask = 2147483647;
624629
files = (
630+
D291DB6C2E468AAF00AA4B64 /* ViewController.m in Sources */,
625631
82EFF30C16E8049500A63CDF /* main.m in Sources */,
626632
82EFF34416E80B6300A63CDF /* AppDelegate.m in Sources */,
627633
);

libs/SalesforceFileLogger/SalesforceFileLoggerTestApp/Classes/AppDelegate.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2424
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
2525
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26-
*/#import "AppDelegate.h"
26+
*/
27+
#import "AppDelegate.h"
28+
#import "ViewController.h"
2729

2830
@interface AppDelegate ()
2931

@@ -34,6 +36,13 @@ @implementation AppDelegate
3436

3537
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
3638
// Override point for customization after application launch.
39+
40+
// Create window and set up the view controller
41+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
42+
ViewController *viewController = [[ViewController alloc] init];
43+
self.window.rootViewController = viewController;
44+
[self.window makeKeyAndVisible];
45+
3746
return YES;
3847
}
3948

libs/SalesforceFileLogger/SalesforceFileLoggerTestApp/ViewController.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
2727
#import "ViewController.h"
28+
#import <SalesforceFileLogger/SalesforceFileLogger.h>
2829

2930
@interface ViewController ()
3031

@@ -35,7 +36,21 @@ @implementation ViewController
3536
- (void)viewDidLoad {
3637
[super viewDidLoad];
3738
// Do any additional setup after loading the view, typically from a nib.
39+
40+
// Log some messages using SFSDKLogger without enabling OSLog
41+
[[SFSDKLogger sharedInstance] i:[self class] message:@"Info log message without OSLog"];
42+
[[SFSDKLogger sharedInstance] w:[self class] message:@"Warning log message without OSLog"];
43+
[[SFSDKLogger sharedInstance] e:[self class] message:@"Error log message without OSLog"];
44+
[[SFSDKLogger sharedInstance] d:[self class] message:@"Debug log message without OSLog"];
45+
46+
[SFSDKLogger setUseOSLog:YES];
47+
48+
// Create a new logger instance with OSLog enabled and log some more messages
49+
SFSDKLogger *osLogTestLogger = [SFSDKLogger sharedInstanceWithComponent:@"OSLog Test"];
50+
[osLogTestLogger i:[self class] message:@"Info log message with OSLog"];
51+
[osLogTestLogger w:[self class] message:@"Warning log message with OSLog"];
52+
[osLogTestLogger e:[self class] message:@"Error log message with OSLog"];
53+
[osLogTestLogger d:[self class] message:@"Debug log message with OSLog"];
3854
}
3955

40-
4156
@end

0 commit comments

Comments
 (0)