From a655e44f176b16d7ae9ec7b366a01dc3fc1068f4 Mon Sep 17 00:00:00 2001 From: Mark Lilback Date: Sat, 2 Dec 2017 12:36:22 -0500 Subject: [PATCH] changed default log format, moved to constant --- Sources/MJLLogger/Formatters.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/MJLLogger/Formatters.swift b/Sources/MJLLogger/Formatters.swift index abec165..01782cd 100644 --- a/Sources/MJLLogger/Formatters.swift +++ b/Sources/MJLLogger/Formatters.swift @@ -21,6 +21,7 @@ public enum LogFormatToken: String { } public class TokenizedLogFormatter: LogFormatter { + public static let defaultLogFormat = "(%date) (%level) (%category), (%function)[(%file):(%line)] (%message)" public enum FormatterError: Error { case invalidFormat } @@ -35,7 +36,7 @@ public class TokenizedLogFormatter: LogFormatter { let dateFormatter: DateFormatterProtocol public init(formatString: String? = nil, dateFormatter: DateFormatterProtocol? = nil) { - self.fmtString = formatString ?? "[(%date)] [(%level)] [(%category)], [(%file):(%line):(%function)] (%message)" + self.fmtString = formatString ?? TokenizedLogFormatter.defaultLogFormat self.dateFormatter = dateFormatter ?? ISO8601DateFormatter() do { let regex = try NSRegularExpression(pattern: "\\(%\\w+\\)", options: .useUnicodeWordBoundaries)