Each time a Logger method is called, LogKit automatically gathers a variety of details regarding the message, its source, the runtime environment, and the host device. These details are collected into a Log Entry instance.

Developers creating custom Entry formatters may choose to include any number of the available properties in their serialization format.

Log Entry Properties

Every LXLogEntry contains the following properties:

Property Type Description
logKitVersion String The version of the LogKit framework that generated the Entry
message String The message provided during the logging call
userInfo [String:AnyObject] Additional values to be provided to each Endpoint’s entryFormatter; always present but may be empty; see here for using userInfo
level String The name of the Log Entry’s Priority Level
timestamp Double The number of seconds since the Unix epoch
dateTime String The timestamp as a string serialized by an Endpoint’s dateFormatter
functionName String The name of the function from which the Log Entry was created
fileName String The name of the source file from which the Log Entry was created
filePath String The absolute path of the source file from which the Log Entry was created
lineNumber Int The line number within the source file from which the Log Entry was created
columnNumber Int The column number within the source file from which the Log Entry was created
threadID String The ID of the thread from which the Log Entry was created
threadName String The name of the thread from which the Log Entry was created
isMainThread Bool An indicator of whether the Log Entry was created on the main thread
osVersionString String A description of the operating system, including its name and version
osMajorVersion Int The major version number of the operating system
osMinorVersion Int The minor version number of the operating system
osPatchVersion Int The patch version number of the operating system
osBuildVersion String The build version string of the operating system
bundleID String The bundle ID of the host application
deviceModel String The model of the device running the application
deviceType String The type of the device running the application
deviceVendorID String The vendor ID of the device running the application (if available)
deviceAdvertisingID String The advertising ID of the device running the application (if available)

Advertising ID

The deviceAdvertisingID Log Entry property is only available on iOS and tvOS devices. However, even on those platforms, the ID is disabled by default to prevent triggering unnecessary IDFA reviews when submitting applications to the App Store. The ID is managed by a compiler flag – thus ensuring applications that do not use the ID will have no code related to the ID in their binaries.

In all cases, LogKit honors the ASIdentifierManager.advertisingTrackingEnabled flag. If an end user has disabled advertising tracking on their device, LogKit will substitute an empty string for the deviceAdvertisingID.

Enabling

Enabling the deviceAdvertisingID for an app that requires this ID is easy; a compiler flag must simply be removed. The flag is found in the LogKit Project’s build settings, in the Swift Compiler - Custom Flags section. Remove the -DLogKitAdvertisingIDDisabled flag from the Other Swift Flags line. The exact process varies a little depending on the installation method used.

Updating to a new version of LogKit may reset the -DLogKitAdvertisingIDDisabled compiler flag, because LogKit includes this flag be default. Be sure to check after updating!

Embedded

Select LogKit.xcodeproj from the Project Navigator, and select the LogKit project item. In the Build Settings tab, find the Swift Compiler - Custom Flags section. Remove -DLogKitAdvertisingIDDisabled from the Other Swift Flags line. You may have to show “All” settings to find the Swift Compiler - Custom Flags section.

Embedded Enabling Advertising ID

CocoaPods

Select Pods from the Project Navigator, and select the LogKit target item. In the Build Settings tab, find the Swift Compiler - Custom Flags section. Remove -DLogKitAdvertisingIDDisabled from the Other Swift Flags line. You may have to show “All” settings to find the Swift Compiler - Custom Flags section.

CocoaPods Enabling Advertising ID

Carthage

Because Carthage integrates an already built framework into your project, removing the -DLogKitAdvertisingIDDisabled is just a little bit trickier.

  1. Run carthage checkout logkit.
  2. Open the LogKit project in Carthage/Checkouts/logkit and modify the compiler flag as desired. The process is identical to the “Embedded” section above.
  3. Close Xcode.
  4. Run carthage build logkit. You may have to add the --configuration Debug option depending on your project’s code signing setup.
  5. If you have not already, you may continue to set up Carthage as you normally would.

Source

If you simply copied all of LogKit’s .swift source files into your project, the compiler flag should be added to your project (because there is no LogKit project in this case). Otherwise, the instructions are the same as the “Embedded” section above.