A logger protocol that provides a common logging interface for different kinds of loggers. In addition, a class with a set of static functions for logging within your code is provided.
Kitura uses this API throughout its implementation when logging.
LoggerAPI package to the dependencies within your application’s
Package.swift file. Substitute
"x.x.x" with the latest
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "x.x.x")
LoggerAPI to your target's dependencies:
.target(name: "example", dependencies: ["LoggerAPI"]),
Add log messages to your application:
Log.warning("This is a warning.") Log.error("This is an error.")
Define a logger
You need to define a
logger in order to output these messages:
Log.logger = ...
You can write your own logger implementation. In the case of Kitura, it defines
HeliumLogger as the logger used by
LoggerAPI. You can find out more about HeliumLogger here.
For more information visit our API reference.
We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
Help us keep the lights on
1.8.0 - Nov 26, 2018
- Add support for building with Swift 5 (#41)
- Drop support for Swift 3.
Note: if you require Swift 3 support, please continue to use the 1.7 release of LoggerAPI.
1.7.3 - Feb 27, 2018
- Support Swift 4.1
1.7.1 - Aug 31, 2017
- Add support for Swift 4
0.10.0 - Aug 8, 2016
New isLogging() API to check current log level
0.9.0 - Jul 29, 2016
Updates to low level APIs to make the code more Swifty