Files
swift-log/Sources/ExampleUsage/ConfigExample.swift
T
tomer doron 9027df5f03 refactor examples and remove dependecy on foundation
motivation:
* due to the low level nature of the library we prefer not to force-load foundation
* help reviewers diffrentiate between examples of usage vs implementation, and add more realistic usage and implementations examples

changes:
* remove foundation from Logging module, replace with c based locks and time functions
* rewrite usage examples to be more realistic
* add example of an implementation that writes to files
* add example of an implementation that is config driven
* rename warn -> warning
2019-01-05 02:03:44 -08:00

22 lines
688 B
Swift

//
// THIS IS NOT PART OF THE PITCH, JUST AN EXAMPLE HOW A LOGGER USAGE LOOKS LIKE
//
import ExampleImplementation
import Foundation
import Logging
enum ConfigExample {
static func main() {
// boostrap with our config based sample implementations
let logging = ConfigLogging()
Logging.bootstrap(logging.make)
// run the example
let logger = Logging.make("com.example.TestApp")
logger.trace("hello world?")
// changes the config in runtime, real implemnetations will use config files instead of in-memory config
logging.config.set(key: "com.example.TestApp", value: .trace)
logger.trace("hello world!")
}
}