collog 0.9.1
collog - colorized logging
collog is a library for colored logging output. The default usage colorizes the available log levels in different colors. But it is also possible to customize all log levels and all format fields. This is done by monkey-patching the standard log library. For further examples have a look at the specs.
Installation
-
Add the dependency to your
shard.yml
:dependencies: collog: github: 4ndyfix/collog
-
Run
shards install
Usage
require "collog"
class SimpleLogExample
Log = ::Log.for self.name
def initialize
::Log.colorized = true
::Log.setup :trace
end
def run
Log.trace { "This is a trace message." }
Log.debug { "This is a debug message." }
Log.info { "This is an info message." }
Log.warn { "This is a warn message!" }
Log.error { "This is an error message!!" }
raise "raised!"
rescue exc
Log.fatal(exception: exc) { "This is a fatal message!!!" }
end
end
SimpleLogExample.new.run
Contributing
- Fork it (https://github.com/your-github-user/collog/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- 4ndyfix - creator and maintainer
Repository
collog
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- almost 2 years ago
- February 24, 2023
License
MIT License
Links
Synced at
Tue, 14 Jan 2025 17:37:03 GMT
Languages