You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation:
Since Swift Log 1.3.0, log handlers can include the source of a particular message,
rendering the [Lifecycle] prefix unnecessary.
Modifications:
Removed the [Lifecycle] prefix from all log messages by removing the underlying
log helper and calling out to the Logger itself.
Result:
Log messages written by a log handler which includes the location wont log "Lifecycle" twice.
Copy file name to clipboardExpand all lines: Sources/Lifecycle/Lifecycle.swift
+11-15Lines changed: 11 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -258,7 +258,7 @@ public struct ServiceLifecycle {
258
258
}
259
259
260
260
privatefunc log(_ message:String){
261
-
self.underlying.log(message)
261
+
self.underlying.logger.info("\(message)")
262
262
}
263
263
}
264
264
@@ -357,7 +357,7 @@ struct ShutdownError: Error {
357
357
/// `ComponentLifecycle` provides a basic mechanism to cleanly startup and shutdown a subsystem in a larger application, freeing resources in order before exiting.
358
358
publicclassComponentLifecycle:LifecycleTask{
359
359
publicletlabel:String
360
-
privateletlogger:Logger
360
+
fileprivateletlogger:Logger
361
361
internalletshutdownGroup=DispatchGroup()
362
362
363
363
privatevarstate=State.idle([])
@@ -435,7 +435,7 @@ public class ComponentLifecycle: LifecycleTask {
435
435
callback(nil)
436
436
case.shutdown:
437
437
self.stateLock.unlock()
438
-
self.log(level:.warning,"already shutdown")
438
+
self.logger.warning("already shutdown")
439
439
callback(nil)
440
440
case.starting(let queue):
441
441
self.state =.shuttingDown(queue)
@@ -476,11 +476,11 @@ public class ComponentLifecycle: LifecycleTask {
0 commit comments