mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
Multiple proposal improvements to the API (#41)
* Move `Logging.make` to a `Logger` initializer. * Remove all factory initializers in example and test code.
This commit is contained in:
1 parent
03174f3260
commit
2474d61a80
19 files changed
+336
-376
No files matched your search
@@ -10,8 +10,7 @@ import Logging
|
||||
enum LocalLoggerBasedSystem {
|
||||
static func main() {
|
||||
// boostrap with our sample implementation
|
||||
let logging = SimpleLogging()
|
||||
Logging.bootstrap(logging.make)
|
||||
Logging.bootstrap(SimpleLogHandler.init)
|
||||
// run the example
|
||||
for i in 1 ... 2 {
|
||||
print("---------------------------- processing request #\(i) ----------------------------")
|
||||
@@ -20,7 +19,7 @@ enum LocalLoggerBasedSystem {
|
||||
}
|
||||
|
||||
class Foo {
|
||||
private var logger = Logging.make("LocalLoggerBasedSystem::Foo")
|
||||
private var logger = Logger(label: "LocalLoggerBasedSystem::Foo")
|
||||
|
||||
func doSomething(requestNumnber: Int) {
|
||||
if 0 == requestNumnber % 2 {
|
||||
@@ -42,7 +41,7 @@ enum LocalLoggerBasedSystem {
|
||||
}
|
||||
|
||||
class Bar {
|
||||
private var logger = Logging.make("LocalLoggerBasedSystem::Bar")
|
||||
private var logger = Logger(label: "LocalLoggerBasedSystem::Bar")
|
||||
|
||||
func doSomething(requestNumnber: Int) {
|
||||
if 0 == requestNumnber % 2 {
|
||||
@@ -58,7 +57,7 @@ enum LocalLoggerBasedSystem {
|
||||
}
|
||||
|
||||
class Baz {
|
||||
private var logger = Logging.make("LocalLoggerBasedSystem::Baz")
|
||||
private var logger = Logger(label: "LocalLoggerBasedSystem::Baz")
|
||||
private let queue = DispatchQueue(label: "LocalLoggerBasedSystem::Baz")
|
||||
|
||||
func doSomething(requestNumnber: Int) {
|
||||
|
||||
Reference in new issue
Block a user