Skip to content

Instantly share code, notes, and snippets.

@kraigspear
Created March 8, 2021 22:46
Show Gist options
  • Save kraigspear/174ecad0b5c6c72294df799a1c05d0f3 to your computer and use it in GitHub Desktop.
Save kraigspear/174ecad0b5c6c72294df799a1c05d0f3 to your computer and use it in GitHub Desktop.
Beaver Logger
//
// BeaverLogger.swift
// Klimate
//
// Created by Kraig Spear on 10/23/20.
//
import Foundation
import SwiftyBeaver
public final class BeaverLogger: Logger {
public func log(level: LogLevel,
message: String,
context: String? = nil,
file: StaticString,
function: StaticString,
line: UInt) {
let beaver = SwiftyBeaver.self
let fullMessage = toMessage(file: file, function: function, line: line, message: message)
switch level {
case .debug:
beaver.debug(fullMessage)
case .error:
beaver.error(fullMessage)
case .info:
beaver.info(fullMessage)
case .verbose:
beaver.verbose(fullMessage)
case .warn:
beaver.warning(fullMessage)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment