Skip to content

Commit

Permalink
Logging: Publish FileLogger for API consumers.
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyl committed Sep 19, 2024
1 parent b6797fe commit 162a835
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/CornucopiaCore/Logging/FileLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import Foundation
extension Cornucopia.Core {

/// A `LogSink` that prints all logs to a file.
struct FileLogger: LogSink {
public struct FileLogger: LogSink {

private let fileHandle: FileHandle?

init(url: URL = "file://") {
public init(url: URL = "file://") {
let fileUrl: URL = .init(fileURLWithPath: url.path)
let directoryName = url.path.CC_dirname
if !FileManager.default.fileExists(atPath: directoryName) {
Expand All @@ -26,7 +26,7 @@ extension Cornucopia.Core {
return formatter
}()

func log(_ entry: LogEntry) {
public func log(_ entry: LogEntry) {
guard let fileHandle = self.fileHandle else { return }
let timestamp = Self.timeFormatter.string(from: entry.timestamp)
let string = "\(timestamp) [\(entry.subsystem):\(entry.category)] <\(entry.thread)> (\(entry.level.character)) \(entry.message)\n"
Expand Down

0 comments on commit 162a835

Please sign in to comment.