Skip to content

Commit

Permalink
Define public init for LogHandler (#128)
Browse files Browse the repository at this point in the history
For clients to be able to define their own log handler solutions, the initialiser must be made public.
  • Loading branch information
Sherlouk authored Jun 26, 2024
1 parent e73280c commit ddd53e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/TelemetryClient/LogHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public struct LogHandler {
let logLevel: LogLevel
let handler: (LogLevel, String) -> Void

public init(logLevel: LogHandler.LogLevel, handler: @escaping (LogHandler.LogLevel, String) -> Void) {
self.logLevel = logLevel
self.handler = handler
}

internal func log(_ level: LogLevel = .info, message: String) {
if level.rawValue >= logLevel.rawValue {
handler(level, message)
Expand Down

0 comments on commit ddd53e4

Please sign in to comment.