mirror of
https://github.com/apple/swift-log
synced 2026-11-23 03:44:22 +00:00
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
19 lines
503 B
Swift
19 lines
503 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 MUXExample {
|
|
static func main() {
|
|
// boostrap with two of our sample implementations
|
|
let logging = MultiplexLogging([SimpleLogging().make, FileLogging().make])
|
|
Logging.bootstrap(logging.make)
|
|
// run the example
|
|
let logger = Logging.make("com.example.TestApp")
|
|
logger.info("hello world!")
|
|
}
|
|
}
|