LogDog
Usage
LogDog is designed to work out of the box, you can use the pre-configured logger anytime, anywhere:
Or, make a local copy and do some changes:
You can quickly create a logger with just a label, it will use the predefined log handler:
SugarLogHandler
The core component that makes this all work is SugarLogHandler
.
The following code snippet shows how to create a SugarLogHandler
and use it to bootstrap the logging system.
Sink
Sinks process log records.
A sink can be a formatter, or a filter, a hook, or a chain of other sinks.
Formatter
You can create a formatter sink with just a closure.
Or use the built-in neat formatters directly.
Filter
You can create a filter sink with just a closure.
DSL
Or use the built-in expressive dsl to create one.
Concat
Sinks are chainable, a sink
can concatenate another sink
.
LogDog ships with many commonly used operators.
Prefix & Suffix
Encode
Crypto
Compress
Schedule
Sinks's processing can be time-consuming, if you don't want it to slow down your work, you can using Scheduler
to make logging asynchronous.
Hook
Because of Scheduler
, the logging may be asynchronous.
It means that the sinking may be in a different context,
You can use hook
with entry.parameters
to capture and pass the context.
Please note, when using encode
, parameters with string as key will also be encoded.
Appender
Appenders are destinations of log records.
Built-in Appenders
OSLogAppender
Append strings to the underlying OSLog
.
TextLogAppender
Append strings to the underlying TextOutputStream
.
MultiplexLogAppender
Append outputs to the underlying appenders.
FileLogAppender
WIP
- [ ] async
- [ ] auto rotate
- [ ] ...
Community
In addition to the sinks/appenders mentioned above, you can also find more integrations at LogDogCommunity!
LogDogChalk
Color the output of LogDog.
LogDogCryptoSwift
Encrypt the output of LogDog.
LogDogCocoaLumberjack
Append the output of LogDog to CocoaLumberjack.
Don't have the sink/appender you want? Contributions are welcome!