Override argument passing it in initializer to variate ConsoleLog
SLLogConsole(isDebug: true, isTerminal: false)
or
SLLogConsole(isTerminal: false)
and so on.
Use isTerminal property to choose between terminal or console settings.
SLLogConsole(isTerminal: false)
To fully configure SLLog pas Configuration object during initialisation.
public init(_ config: Configuration = Configuration())
By default, logs are set for a terminal.
log format ":d :t :f::l :m" where
`:d` is replaced in string to display date
`:t` is replaced by log type
`:f` is replaced by file name
`:l` is replaced by line number
`:m` is replaced by message object
Default date format used by logger is as follow "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
To get rid of default log colors pass empty dictionary in logColors or dictionary with your own definitions.
For more information about terminal color take a look: https://misc.flogisoft.com/bash/tip_colors_and_formatting
LogColor
LogColor is defined as follow init(_ terminal: String, _ console: String)
For XCode console emoticons are used as collor.
Use TerminalColor to fast access predefined colors values
5 SLLogFile
SLLogFile save logs to files which are created on daily basis.
File names are as follows: "yyyy-MM-dd". Created under :yuorPath/sllogs with extension .log
Default maxFilesCount is set to 3 wich means logger stores 3 files at a time.
1 file = 1 day logs
SLLog
SLLog is a simple yet elegant swift logger. Allows you to log content to file, console or your custom target.
🔧 Installation
Add the following dependency to your
Package.swift
file:💊 How To Start
1 Import
On top of your file import:
2 Usage
Log any information you need with
Log
classAny object.
3 Initialize
Setup SLLoger
Or console handler
or both
You can create your custom log handler. Simply correspond to
LogHandler
protocol.then add it to SLLog
4 Providers
SLLog can have custom providers. To add your own provider
can you can use
LogProvider
build in method send. To send your log via SLLog.5 SLLogConsole
Default console log:
Override argument passing it in initializer to variate ConsoleLog
SLLogConsole(isDebug: true, isTerminal: false)
orSLLogConsole(isTerminal: false)
and so on. Use isTerminal property to choose between terminal or console settings.SLLogConsole(isTerminal: false)
To fully configure SLLog pas
Configuration
object during initialisation.public init(_ config: Configuration = Configuration())
By default, logs are set for a terminal. log format
":d :t :f::l :m"
whereDefault date format used by logger is as follow
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
To get rid of default log colors pass empty dictionary in
logColors
or dictionary with your own definitions. For more information about terminal color take a look:https://misc.flogisoft.com/bash/tip_colors_and_formatting
LogColor
LogColor is defined as follow
init(_ terminal: String, _ console: String)
For XCode console emoticons are used as collor.Use
TerminalColor
to fast access predefined colors values5 SLLogFile
SLLogFile save logs to files which are created on daily basis. File names are as follows:
"yyyy-MM-dd"
. Created under:yuorPath/sllogs
with extension.log
DefaultmaxFilesCount
is set to3
wich means logger stores 3 files at a time. 1 file = 1 day logs⭐ Contributing
Be welcome to contribute to this project! :)
❓ Questions
You can create an issue on GitHub.
📝 License
This project was released under the MIT license.