This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
StephenHynes7
committed
Feb 20, 2014
0 parents
commit 14038b1
Showing
35 changed files
with
2,711 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
xcuserdata/ | ||
project.xcworkspace/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
|
||
Logentries logging for iOS | ||
========================== | ||
|
||
|
||
Main features | ||
------------- | ||
|
||
* online/offline logging | ||
* dictionary serialization | ||
* secure TLS connection | ||
* thread safety | ||
* application lifecycle logging | ||
* application crash logging with stack traces | ||
|
||
Installation | ||
------------ | ||
|
||
Just add files from lelib group into your project. | ||
|
||
Simple example | ||
-------------- | ||
|
||
```objectivec | ||
#import "lelib.h" | ||
|
||
LELog* log = [LELog sharedInstance]; | ||
log.token = @"f66815d1-702c-414b-8dcc-bb73de372584"; | ||
|
||
[log log:@"Hello World"]; | ||
``` | ||
|
||
Early initialization | ||
-------------------- | ||
|
||
The library automatically hooks up to the exception handler and logs unhandled | ||
exceptions. This means that you should initialize the library as soon as | ||
possible to log all exceptions. Insert following lines to main.m to log | ||
exceptions even before application:didFinishLaunchingWithOptions: is invoked. | ||
|
||
```objectivec | ||
|
||
#import "lecore.h" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
@autoreleasepool { | ||
|
||
le_init(); | ||
le_set_token("aaabacad-aeaf-4321-1234-abcdef012345"); | ||
|
||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | ||
} | ||
} | ||
|
||
The token is stored in global variable. You don't have to setup token property | ||
of LELog instance later. | ||
|
||
``` | ||
Quick questions | ||
--------------- | ||
**Any dependencies?** No dependencies. The library uses standard Obj-C and POSIX C. | ||
**How to log an event?** Simply call `[log log:@"Hello world"];` | ||
**No network coverage?** Log entries are stored in a file and sent to Logentries when the network is back. | ||
**When app crashes?** If configured, the library logs information about the application crash with stack trace. | ||
**When app is forced to shut down by OS?** There is no way to log it. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// AppDelegate.h | ||
// demo | ||
// | ||
// Created by Petr on 25/11/13. | ||
// Copyright (c) 2013 JLizard. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// AppDelegate.m | ||
// demo | ||
// | ||
// Created by Petr on 25/11/13. | ||
// Copyright (c) 2013 JLizard. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
|
||
@implementation AppDelegate | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
// Override point for customization after application launch. | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
} | ||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
} | ||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
} | ||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/> | ||
</dependencies> | ||
<scenes> | ||
<!--class Prefix:identifier View Controller--> | ||
<scene sceneID="ufC-wZ-h7g"> | ||
<objects> | ||
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS"> | ||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/> | ||
</objects> | ||
</scene> | ||
</scenes> | ||
<simulatedMetricsContainer key="defaultSimulatedMetrics"> | ||
<simulatedStatusBarMetrics key="statusBar"/> | ||
<simulatedOrientationMetrics key="orientation"/> | ||
<simulatedScreenMetrics key="destination" type="retina4"/> | ||
</simulatedMetricsContainer> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
demo/Images.xcassets/LaunchImage.launchimage/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"extent" : "full-screen", | ||
"minimum-system-version" : "7.0", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"orientation" : "portrait", | ||
"idiom" : "iphone", | ||
"subtype" : "retina4", | ||
"extent" : "full-screen", | ||
"minimum-system-version" : "7.0", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// ViewController.h | ||
// demo | ||
// | ||
// Created by Petr on 25/11/13. | ||
// Copyright (c) 2013 JLizard. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface ViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// ViewController.m | ||
// demo | ||
// | ||
// Created by Petr on 25/11/13. | ||
// Copyright (c) 2013 JLizard. All rights reserved. | ||
// | ||
|
||
#import "ViewController.h" | ||
#import "lelib.h" | ||
|
||
@interface ViewController () | ||
|
||
@end | ||
|
||
@implementation ViewController | ||
|
||
- (void)writeTimerFired:(NSTimer*)timer | ||
{ | ||
LELog* log = [LELog sharedInstance]; | ||
[log log:timer.userInfo]; | ||
} | ||
|
||
- (void)scheduleLog:(NSString*)message after:(NSTimeInterval)seconds | ||
{ | ||
[NSTimer scheduledTimerWithTimeInterval:seconds target:self selector:@selector(writeTimerFired:) userInfo:message repeats:NO]; | ||
} | ||
|
||
- (void)logManyFired:(NSTimer*)timer | ||
{ | ||
static NSInteger counter = 1; | ||
|
||
if (counter > 10) return; | ||
|
||
LELog* log = [LELog sharedInstance]; | ||
for (NSInteger i = 1; i < 10; i++) { | ||
NSString* message = [NSString stringWithFormat:@"logging serie %ld index %ld", (long)counter, (long)i]; | ||
[log log:message]; | ||
} | ||
|
||
counter++; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
LELog* log = [LELog sharedInstance]; | ||
log.token = @"f66815d1-702c-414b-8dcc-bb73de372584"; | ||
log.logApplicationLifecycleNotifications = YES; | ||
|
||
|
||
/* | ||
// test exception logging handler | ||
NSArray* x = [NSArray arrayWithObject:nil]; | ||
NSLog(@"%@", x); | ||
*/ | ||
|
||
/* | ||
// simple logging | ||
[log log:@"test A"]; | ||
[log log:@"test B"]; | ||
[log log:@{@(123):@"test C"}]; | ||
*/ | ||
|
||
[self scheduleLog:@"test 10s" after:10]; | ||
[self scheduleLog:@"test 20s" after:20]; | ||
|
||
/* | ||
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(logManyFired:) userInfo:nil repeats:YES]; | ||
*/ | ||
|
||
} | ||
|
||
- (void)didReceiveMemoryWarning | ||
{ | ||
[super didReceiveMemoryWarning]; | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.logentries.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Prefix header | ||
// | ||
// The contents of this file are implicitly included at the beginning of every source file. | ||
// | ||
|
||
#import <Availability.h> | ||
|
||
#ifndef __IPHONE_5_0 | ||
#warning "This project uses features only available in iOS SDK 5.0 and later." | ||
#endif | ||
|
||
#ifdef __OBJC__ | ||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// main.m | ||
// demo | ||
// | ||
// Created by Petr on 25/11/13. | ||
// Copyright (c) 2013 JLizard. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import "AppDelegate.h" | ||
#import "lecore.h" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
@autoreleasepool { | ||
le_init(); | ||
le_set_token("f66815d1-702c-414b-8dcc-bb73de372584"); | ||
le_log("nazdar"); | ||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | ||
} | ||
} |
Oops, something went wrong.