Console Endpoint
The LXConsoleEndpoint
writes Log Entries to the console (stdout
).
The Console Endpoint is safe to be used in environments featuring concurrency, and may or may not perform work asynchronously depending on its initialization parameters. Please see below.
Usage
Initializers
The following initializers are available for LXConsoleEndpoint
:
Parameters
synchronous |
Type: Bool Default: true |
Specifies whether synchronous writing is desired |
minimumPriorityLevel |
Type: LXPriorityLevel Default: .All |
The minimum Priority Level a Log Entry must meet to be accepted by this Endpoint |
dateFormatter |
Type: LXDateFormatter Default: .standardFormatter() |
The formatter used by this Endpoint to serialize a Log Entry’s dateTime property to a string |
entryFormatter |
Type: LXEntryFormatter Default: .standardFormatter() |
The formatter used by this Endpoint to serialize each Log Entry to a string |
If synchronous behavior is selected, the application will wait for each Log Entry to be printed to the console before continuing execution. This behavior is very helpful when debugging, but may reduce performance compared to the asynchronous behavior.
If asynchronous behavior is selected, Log Entries are not guaranteed to be printed before execution continues. This behavior can significantly improve performance, especially in environments featuring concurrency. However, an application making a logging call directly before crashing may crash before the Entry has a chance to be printed. While debugging an application, it is recommended to specify the synchronous behavior.
Returns an initialized Console Endpoint instance.