-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BBLogFormat to customize text output (#43)
* Add console output string formatter property * Added log level icon * Fixed unit tests * Replaced var with let * Removed stringFormatter from event class, passed it to loggers through init * Renaming BBConsoleStringFormatter to BBLogFormat * Removed unused consoleFormatter property from BB * Revert "Fixed unit tests", renaming OSlogger init arg This reverts commit 095c51e. * Maked default BBLogFormat unmutable * BBlogFormat removed from namespace BlackBox * Added tests checked applying BBlogFormat in OSLogger * Added BBLogFormat.swift to carthage source files * Added tvOS and watchOS to @available attribute in test --------- Co-authored-by: Alexander Fomin <A.Fomin@buzzolls.ruA.Fomin@buzzolls.ruA.Fomin@buzzolls.ru> Co-authored-by: Alexander Fomin <a.fomin@buzzolls.ru>
- Loading branch information
1 parent
0cf140c
commit 69fafe2
Showing
8 changed files
with
123 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Foundation | ||
|
||
public struct BBLogFormat { | ||
let userInfoFormatOptions: JSONSerialization.WritingOptions | ||
let sourceSectionInline: Bool | ||
let showLevelIcon: Bool | ||
|
||
/// Creates `BBLogFormat` instance | ||
/// - Parameters: | ||
/// - userInfoFormatOptions:Options for output JSON data. | ||
/// - sourceSectionInline: Print `Source` section in console inline | ||
/// - showLevelIcon: Boolean value defines showing log level icon in console | ||
public init( | ||
userInfoFormatOptions: JSONSerialization.WritingOptions, | ||
sourceSectionInline: Bool, | ||
showLevelIcon: Bool | ||
) { | ||
self.userInfoFormatOptions = userInfoFormatOptions | ||
self.sourceSectionInline = sourceSectionInline | ||
self.showLevelIcon = showLevelIcon | ||
} | ||
|
||
public static let `default` = BBLogFormat(userInfoFormatOptions: .prettyPrinted, | ||
sourceSectionInline: false, | ||
showLevelIcon: false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters