Skip to content

Commit

Permalink
docs: resolve #139
Browse files Browse the repository at this point in the history
  • Loading branch information
akornich committed Mar 22, 2022
1 parent 278e8b3 commit ebf1f48
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ - (void)setUp {
DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 1;
// he above code tells the application to keep a day worth of log files on the system.
// the above code tells the application to keep a day worth of log files on the system.

[DDLog addLogger:fileLogger];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class RollbarCocoaLumberjackTests: XCTestCase {
XCTAssertEqual(RollbarLogger.readPayloadsFromSdkLog().count, 0);

dynamicLogLevel = DDLogLevel.debug;
DDLog.add(DDOSLogger .sharedInstance);
DDLog.add(DDOSLogger.sharedInstance);
let ddFileLogger = DDFileLogger();
ddFileLogger.rollingFrequency = 60 * 60 * 24; // 24-hours rolling
ddFileLogger.logFileManager.maximumNumberOfLogFiles = 1;
// he above code tells the application to keep a day worth of log files on the system.
// the above code tells the application to keep a day worth of log files on the system.
DDLog.add(ddFileLogger);

DDLog.add(RollbarCocoaLumberjackLogger.create(with: rollbarConfig));
Expand Down
3 changes: 3 additions & 0 deletions RollbarSDK.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 37 additions & 4 deletions docs/SDK module - RollbarCocoaLumberjack.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,62 @@ Implements CocoaLumberjack compatible logger (`DDLogger`) capable of "intercepti
2. Accordingly, import our *RollbarCocoaLumberjack* module.
3. Setup properly configured `RollbarConfig` object.
4. Create a `RollbarCocoaLumberjackLogger` instance using the preconfigured `RollbarConfig` instance and add it to the `DDLog`
5. Fro this point on, all relevant log entries made anywhere via the *CocoaLumberjack* logging methods will be "forked" to Rollbar based on filtering conditions specified on both levels: *CocoaLumberjackLogger* configuration and in `RollbarConfig` instances defined above.
5. From this point on, all relevant log entries made anywhere via the *CocoaLumberjack* logging methods will be "forked" to Rollbar based on filtering conditions specified on both levels: *CocoaLumberjackLogger* configuration and in `RollbarConfig` instances defined above.

#### Objective-C

```Obj-C
//...
#define LOG_LEVEL_DEF ddLogLevel
//...
@import CocoaLumberjack;
@import RollbarCocoaLumberjack;
//...

//...
// setting up CocoaLumberjack usage:
[DDLog addLogger:[DDOSLogger sharedInstance]];

DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 1;
// the above code tells the application to keep a day worth of log files on the system.
[DDLog addLogger:fileLogger];

// create a valid RTollbar config:
RollbarConfig *config = [[RollbarConfig alloc] init];
config.destination.accessToken = @"ROLLBAR_ACCESS_TOKEN";
config.destination.environment = @"ROLLBAR_ENVIRONMENT";
config.developerOptions.transmit = YES;
config.developerOptions.logPayload = YES;
config.loggingOptions.maximumReportsPerMinute = 5000;

// add Rollbar logger plug-in for CocoaLumberjack:
[DDLog addLogger:[RollbarCocoaLumberjackLogger createWithRollbarConfig:config]];
//...
```
#### Swift
```Swift
//...
import CocoaLumberjackSwift
import RollbarCocoaLumberjack
//...
//...
// setting up CocoaLumberjack usage:
dynamicLogLevel = DDLogLevel.debug;
DDLog.add(DDOSLogger.sharedInstance);
let ddFileLogger = DDFileLogger();
ddFileLogger.rollingFrequency = 60 * 60 * 24; // 24-hours rolling
ddFileLogger.logFileManager.maximumNumberOfLogFiles = 1;
// the above code tells the application to keep a day worth of log files on the system.
DDLog.add(ddFileLogger);
// create a valid RTollbar config:
let rollbarConfig = RollbarConfig();
rollbarConfig.destination.accessToken = RollbarTestHelper.getRollbarPayloadsAccessToken();
rollbarConfig.destination.environment = RollbarTestHelper.getRollbarEnvironment();
// add Rollbar logger plug-in for CocoaLumberjack:
DDLog.add(RollbarCocoaLumberjackLogger.create(with: rollbarConfig));
```

0 comments on commit ebf1f48

Please sign in to comment.