Skip to content

Commit

Permalink
changed default log format, moved to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mlilback committed Dec 2, 2017
1 parent 0f613ac commit a655e44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/MJLLogger/Formatters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down

0 comments on commit a655e44

Please sign in to comment.