Swift Logger Class for Usage With Swift Logger Server Application
Simple Logger class used for sending Debug, Info, Warning and Error log messages to the logger API.
- Open Source Swift 4.0.0 or higher
- macOS Sierra 10.12.6 or higher
- Xcode Version 9.0 (9A325) or higher
- iOS 10.0 or higher
- Ubuntu 16.04 & 16.10 (only tested on 16.04)
import SwiftLoggerClient
The following public variables should be set to your desired values.
public let SWIFT_LOGGER_backEndSchema = "http"
public let SWIFT_LOGGER_backEndPort: Int16 = 80
let log = Logger(applicationName: String, target: Target, onServer: String, state: State)
public enum Target {
case file
case terminal
}
public enum State {
case enabled
case disabled
}
let log = Logger(applicationName: "MyApplication", target: .file, onServer: "logging.craftwell.io", state: .enabled)
log.debug(message: "This is a debug message.")
log.info(message: "This is an info message.")
log.warning(message: "This is a warning message.")
log.error(message: "An error has occurred.")
// Event can also be logged without passing message parameter:
log.debug()
log.info()
log.warning()
log.error()
More information about server API configuration is to be found on: Logging Events Using Swift Cloud Logger