Skip to content

iosphere/ISHLogDNA

Repository files navigation

LogDNA for iOS

This micro-framework supports remote logging via LogDNA on iOS. The framework itself is written in ObjC for easy integration in Swift and ObjC apps.

Requires a deployment target of iOS 9 and above.

Sample

Objective-C

[ISHLogDNAService setupWithIngestionKey:ingestionKey
                               hostName:hostName
                                appName:appName];

// Send message including custom meta data (the dictionary must be encodable into JSON)
ISHLogDNAMessage *m;
m = [ISHLogDNAMessage messageWithLine:@"Sample app started"
                                level:ISHLogDNALevelInfo
                                 meta:@{@"anyKey" : @[@1, @42]}];
[ISHLogDNAService logMessages:@[m]];

Swift

ISHLogDNAService.setup(withIngestionKey: "", hostName: "", appName: "")

let message = ISHLogDNAMessage(line: "Sample app started", level: .info, meta: [ "myField" : 42 ])
ISHLogDNAService.logMessages([message]);

Usage

Simply include the following files in your project:

  • ISHLogDNAService.h
  • ISHLogDNAService.m

For Swift: ensure to include #import "ISHLogDNAService.h" in your bridging header.

ISHLogDNAService uses the AdSupport framework to use a sensible default for the enabled flag. By default logging is only enabled for users with isAdvertisingTrackingEnabled.

About

Remote logging for iOS via LogDNA with a simple Objective-C (Swift-compatible) wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published