change example loggers to structs (#29)

motivation: encourage use of immutable loggers

changes: change example loggers to structs
This commit is contained in:
tomer doron authored and Johannes Weiss committed 2019-01-17 18:10:54 +00:00
1 parent 0bf0588b17
commit 1d983153b4
5 files changed
+5 -5

No files matched your search

@@ -8,7 +8,7 @@ import Logging
// this is a contrived example of a logging library implementation that allows users to define log levels per logger label
// this example uses a simplistic in-memory config which can be changed at runtime via code
// real implementations could use external config files that can be changed outside the running program
public final class ConfigLogging {
public struct ConfigLogging {
public var config = Config(defaultLogLevel: .info)
public init() {}
@@ -11,7 +11,7 @@ import Logging
#endif
// this is a contrived example of a logging library implementation that writes logs to files
public final class FileLogging {
public struct FileLogging {
private let defaultLogLevel: Logging.Level = .info
private let fileHandler = FileHandler()
@@ -6,7 +6,7 @@ import Foundation
import Logging
// helper class to keep things DRY
internal final class SimpleLogger {
internal struct SimpleLogger {
let label: String
private var _logLevel: Logging.Level?
private let formatter: DateFormatter
@@ -6,7 +6,7 @@ import Foundation
import Logging
// this is a contrived example of a logging library implementation that writes logs to stdout
public final class SimpleLogging {
public struct SimpleLogging {
private let defaultLogLevel = Logging.Level.info
public init() {}