Swiftpack.co - Package - nakkht/logr

Logr

build status platforms codecov documentation

Simple logging library for iOS written in Swift

Features

  • ☑ Inferred tags
  • ☑ Swift Package Manager/Carthage/CocoaPods integration
  • ☑ Highly extensible
  • ☑ Logging to multiple targets/destination at the same time
  • ☑ Console logging out of the box via ConsoleTarget
  • ☑ File logging out of the box via FileTarget
  • ☑ Pure Swift 5
  • ☑ Optional file header for each file

Integration

Swift Package Manager

Once Swift package set up, add the following to your Package.swift:

dependencies: [
  .package(url: "https://github.com/nakkht/logr.git", exact: "0.8.0")
]

Carthage

To add Logr to your project using Carthage, add the following to your Cartfile:

github "nakkht/logr" "0.8.0"

CocoaPods

To integrate using CocoaPods, install CocoaPods and include the following in your Podfile:

pod 'Logr', '~> 0.8.0'

Usage

In your AppDelegate.swift file add:

import Logr

At the beginning of func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool configure logr service with wanted targets:

LogrService.init(with: Config(ConsoleTarget(), FileTarget()))

For more serious configuration in production, it is recommended to ommit ConsoleTarget. The following snippet is suggested:

#if DEBUG
static let targets: [Target] = [ConsoleTarget(), FileTarget()]
#else
static let targets: [Target] = [FileTarget()]
#endif

static let config = Config(targets: targets)

LogrService.init(with: config)

Demo

Demo project can be access by opening Demo.workspace in Demo subfolder.

Documentation

Author

Licence

This repository is under the Apache v2.0 license. Find it here.

Copyright 2020 Paulius Gudonis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Github

link
Stars: 2

Dependencies

Used By

Total: 0

Releases

v0.8.0 - 2020-09-21 20:04:28

Added

  • Tests for minimum logged level
  • Swift 5.3 support

Changed

  • WatchOS support to v3
  • Code organization

Fixed

  • defaultDateTimeFormat in FileTargetConfig missing full minutes

v0.7.0 - 2020-07-23 19:07:44

Added

  • Optional headers for log files

v0.6.1 - 2020-06-14 10:26:16

Fixed

  • Package.swift to use version 10.14 for the macOS platform

v0.6.0 - 2020-06-14 00:32:01

Added

  • Inferred tags
  • tvOS support
  • macOS support

v0.5.0 - 2020-03-20 19:56:08

Added

  • Interactive demo
  • More documentation
  • Tag for Logr class

v0.4.0 - 2019-11-13 22:42:58

Added

  • Carthage support

v0.3.4 - 2019-11-12 13:15:27

Fixed

  • Creating archive folder if does not exist

v0.3.3 - 2019-11-12 11:58:44

Fixed

  • Archive folder created as file instead of folder

v0.3.2 - 2019-11-12 11:36:35

Added

  • Documentation for public apis
  • Dispatch queue configuration for file target

Fixed

  • Using wrong url for deleting/renaming archived files

v0.3.1 - 2019-11-11 13:18:09

Added

  • Message struct
  • More tests for FileTargetConfig

Fixed

  • Access modifiers for ConsoleTargetConfig/FileTargetConfig/Config initialisers

v0.3.0 - 2019-10-16 21:37:48

Added

  • Swift Package Manager support

Fixed

  • Setting maxArchivedFilesCount in FileTargetConfig

v0.2.0 - 2019-09-17 21:44:48

Added

  • Logging to a file (FileTarget)
  • Config option to set your own dispatch queue
  • Log levels per target config

v0.1.0 - 2019-08-20 21:57:29

Added

  • Main logging mechanism
  • Target concept
  • ConsoleTarget for logging to console