-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Glider/Sources/Formatters/OSLogFormatter/OSLogFormatter.swift
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,46 @@ | ||
// | ||
// Glider | ||
// Fast, Lightweight yet powerful logging system for Swift. | ||
// | ||
// Created & Maintained by Mobile Platforms Team @ ImmobiliareLabs.it | ||
// Email: mobile@immobiliare.it | ||
// Web: http://labs.immobiliare.it | ||
// | ||
// Authors: | ||
// - Daniele Margutti <hello@danielemargutti.com> | ||
// | ||
// Copyright ©2022 Immobiliare.it SpA. | ||
// Licensed under MIT License. | ||
// | ||
|
||
import Foundation | ||
|
||
/// The`OSLogFormatter` is used to print messages directly on XCode debug console with OSLog. | ||
open class OSLogFormatter: FieldsFormatter { | ||
|
||
// MARK: - Initialization | ||
|
||
public init() { | ||
super.init(fields: Self.defaultFields()) | ||
} | ||
|
||
/// Return the default fields of the default `TerminalFormatter` configuration. | ||
/// | ||
/// - Parameters: | ||
/// - colorize: colorize mode. | ||
/// - colorizeFields: colorized fields. | ||
/// - Returns: `[FieldsFormatter.Field]` | ||
open class func defaultFields() -> [FieldsFormatter.Field] { | ||
[ | ||
.timestamp(style: .iso8601), | ||
.literal(" "), | ||
.message() | ||
].compactMap({ $0 }) | ||
} | ||
|
||
@available(*, unavailable) | ||
public override init(fields: [FieldsFormatter.Field]) { | ||
fatalError("Use init(options:) for JSONFormatter") | ||
} | ||
|
||
} |
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