Categories: None [Edit]
fancy_logger
# Fancy Logger
An easily customizable logger with style.
## Install
### Bundler: `gem 'fancy_logger'`
### RubyGems: `gem install fancy_logger`
## Usage
Simply use as if you were using the normal Ruby `Logger` class:
```ruby
require 'fancy_logger'
logger = FancyLogger.new(STDOUT)
logger.info "Hello"
```
### Config
The `config` instance method allows you to modify the configuration of the Logger within a DSL.
Continuing with our last example:
```ruby
logger.config do
timestamp_format "%c"
styles do
info do
foreground :yellow
blink true
end
end
end
logger.debug 'Look here!'
logger.info 'Doing things...'
logger.warn 'Watch out!'
logger.error 'Bad'
logger.fatal 'VERY bad'
logger.unknown 'Weird unknown stuff'
```
#### Output
![][output_example]
### Config
```ruby
# The format of the timestamp in the log. Follows the strftime standards.
timestamp_format "%F %r"
# On the first logged message, FancyLogger will prepend a help message
# containing a list of all the severities (debug, info, warn, etc) styled
# according to your config as reference.
# You can disable this by setting the below option to false.
show_help_message true
# Under styles, you have a configuration for each severity.
# Each severity has a configuration with the following valid options:
# Key: foreground
# Value:
# :default, :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white
#
# Key: background
# Value:
# :default, :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white
#
# Key: reset
# Value: true or false
#
# Key: bright
# Value: true or false
#
# Key: italic
# Value: true or false
#
# Key: underline
# Value: true or false
#
# Key:
# blink
# Value: true or false
#
# Key: inverse
# Value: true or false
#
# Key: hide
# Value: true or false
styles do
debug do
foreground :black
background :cyan
end
info do
foreground :default
background :default
end
warn do
foreground :yel...
Total
Ranking: 74,791 of 198,088
Downloads: 13,917
Daily
Ranking: 58,253 of 198,053
Downloads: 2
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
| Rank | Downloads | Name |
|---|---|---|
| 6,164 | 1,080,755 | jquery-cookie-rails |
| 85,312 | 11,394 | morris-rails |
Depends on
| Rank | Downloads | Name |
|---|---|---|
| 8 | 1,453,565,735 | rake |
| 53 | 775,698,202 | rainbow |
| 96 | 524,993,458 | rb-fsevent |
| 394 | 138,722,687 | redcarpet |
| 423 | 131,629,776 | guard-rspec |
| 794 | 73,723,289 | fuubar |
| 1,465 | 31,091,003 | github-markup |
| 4,385 | 2,380,093 | version |
| 7,522 | 671,744 | guard-yard |
| 38,617 | 34,748 | outline |
| 42,684 | 30,407 | at |
Owners
| # | Gravatar | Handle |
|---|---|---|
| 1 | RyanScottLewis |