Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from candotti/feature/New_class_methods
Browse files Browse the repository at this point in the history
New class methods
  • Loading branch information
Viliam Holub committed May 18, 2016
2 parents becdd7e + b63daf5 commit 37768a8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,32 @@ log.token = @"LOGENTRIES_TOKEN";
[log log:@"Hello World"];
```

Or with the class methods
--------------

```objectivec
#import "lelib.h"

[LELog sessionWithToken:@"LOGENTRIES_TOKEN"];

[LELog log:@"Hello World"];
```
Log easy around your classes
--------------
Add to your .pch
```objectivec
#import "lelib.h"
```
and call from your classes
```objectivec

[LELog log:@"Hello World"];

```


Early initialization
--------------------

Expand Down
3 changes: 3 additions & 0 deletions lelib/LELog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

+ (LELog*)sharedInstance;

+ (LELog*)sessionWithToken:(NSString*)token;
/*
Display all messages on TTY for debug purposes
*/
Expand All @@ -39,6 +40,8 @@
*/
- (void)log:(NSObject*)object;

+ (void)log:(NSObject*)object;

/*
Log UIApplicationDidFinishLaunchingNotification, UIApplicationDidBecomeActiveNotification,
UIApplicationWillEnterForegroundNotification, UIApplicationWillResignActiveNotification,
Expand Down
11 changes: 10 additions & 1 deletion lelib/LELog.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ - (void)log:(NSObject*)object
le_poke();
}

+ (void)log:(NSObject *)object{

[[self sharedInstance] log:object];
}
+ (LELog*)sharedInstance
{
static dispatch_once_t once;
Expand All @@ -70,7 +74,12 @@ + (LELog*)sharedInstance
});
return sharedInstance;
}

+(LELog*)sessionWithToken:(NSString*)token{

LELog * leLog = [self sharedInstance];
[leLog setToken:token];
return leLog;
}
- (void)setToken:(NSString *)token
{
le_set_token([token cStringUsingEncoding:NSUTF8StringEncoding]);
Expand Down

0 comments on commit 37768a8

Please sign in to comment.