GithubHelp home page GithubHelp logo

unifiedlogging's Introduction

UnifiedLogHandler

Swift 5.1 Platforms Swift Package Manager Twitter: @gonzalezreal

UnifiedLogHandler is a SwiftLog backend that uses Apple's Unified Logging System.

You can instruct SwiftLog to use the UnifiedLogHandler backend as follows:

import Logging
import UnifiedLogHandler

LoggingSystem.bootstrap(UnifiedLogHandler.init)

The UnifiedLogHandler creates an OSLog for each Logger in your application or its libraries. It uses the application's bundle identifier and the Logger's label as the OSLog subsystem and category, respectively.

For example:

let logger = Logger(label: "APIClient")
logger.info("Something happened")

Prints the following output:

2019-12-15 18:22:10.357062+0100 MyApp[63417:16193919] [APIClient] Something happened

You can also use metadata when logging. For example:

logger.info("Something happened", metadata: ["foo": ["bar": "baz"]])

Prints the following output:

2019-12-15 18:34:01.424326+0100 MyApp[63587:16235713] [APIClient] Something happened
├─ Metadata
│ foo: ["bar": "baz"]

Installation

Using the Swift Package Manager

Add UnifiedLogHandler as a dependency to your Package.swift file. For more information, see the Swift Package Manager documentation.

.package(url: "https://github.com/gonzalezreal/UnifiedLogHandler", from: "1.0.0")

Help & Feedback

  • Open an issue if you need help, if you found a bug, or if you want to discuss a feature request.
  • Open a PR if you want to make some change to UnifiedLogHandler.
  • Contact @gonzalezreal on Twitter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.