Module: Yell
- Defined in:
- lib/yell.rb,
lib/yell/event.rb,
lib/yell/level.rb,
lib/yell/logger.rb,
lib/yell/version.rb,
lib/yell/adapters.rb,
lib/yell/loggable.rb,
lib/yell/silencer.rb,
lib/yell/formatter.rb,
lib/yell/repository.rb,
lib/yell/adapters/io.rb,
lib/yell/helpers/base.rb,
lib/yell/adapters/base.rb,
lib/yell/adapters/file.rb,
lib/yell/configuration.rb,
lib/yell/helpers/level.rb,
lib/yell/helpers/tracer.rb,
lib/yell/helpers/adapter.rb,
lib/yell/adapters/streams.rb,
lib/yell/helpers/silencer.rb,
lib/yell/adapters/datefile.rb,
lib/yell/helpers/formatter.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Adapters, Helpers, Loggable Classes: AdapterNotFound, Configuration, Event, Formatter, Level, Logger, LoggerNotFound, Repository, Silencer
Constant Summary collapse
- Severities =
Holds all Yell severities
['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'UNKNOWN'].freeze
- VERSION =
"2.0.5"
- NoFormat =
No format on the log message
"%m"
- DefaultFormat =
Default Format
"%d [%5L] %p : %m"
- BasicFormat =
Basic Format
"%l, %d : %m"
- ExtendedFormat =
Extended Format
"%d [%5L] %p %h : %m"
Class Method Summary collapse
-
.[](name) ⇒ Yell::Logger
Shortcut to Yell::Repository[].
-
.[]=(name, logger) ⇒ Yell::Logger
Shortcut to Yell::Repository[]=.
- .__deprecate__(version, message, options = {}) ⇒ Object
- .__fetch__(hash, *args) ⇒ Object
- .__warn__(*messages) ⇒ Object
- .env ⇒ Object
-
.format(pattern = nil, date_pattern = nil, &block) ⇒ Yell::Formatter
Shortcut to Yell::Fomatter.new.
-
.level(val = nil) ⇒ Yell::Level
Shortcut to Yell::Level.new.
-
.load!(file) ⇒ Yell::Logger
Loads a config from a YAML file.
-
.new(*args, &block) ⇒ Yell::Logger
Creates a new logger instance.
-
.register(name, klass) ⇒ Object
Shortcut to Yell::Adapters.register.
Class Method Details
.[](name) ⇒ Yell::Logger
Shortcut to Yell::Repository[]
49 50 51 |
# File 'lib/yell.rb', line 49 def []( name ) Yell::Repository[name] end |
.[]=(name, logger) ⇒ Yell::Logger
Shortcut to Yell::Repository[]=
56 57 58 |
# File 'lib/yell.rb', line 56 def []=( name, logger ) Yell::Repository[name] = logger end |
.__deprecate__(version, message, options = {}) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/yell.rb', line 93 def __deprecate__( version, , = {} ) #:nodoc: = ["Deprecation Warning (since v#{version}): #{}" ] << " before: #{[:before]}" if [:before] << " after: #{[:after]}" if [:after] __warn__(*) end |
.__fetch__(hash, *args) ⇒ Object
109 110 111 112 113 114 |
# File 'lib/yell.rb', line 109 def __fetch__( hash, *args ) = args.last.is_a?(Hash) ? args.pop : {} value = args.map { |key| hash.fetch(key.to_sym, hash[key.to_s]) }.compact.first value.nil? ? [:default] : value end |
.__warn__(*messages) ⇒ Object
102 103 104 105 106 |
# File 'lib/yell.rb', line 102 def __warn__( * ) #:nodoc: $stderr.puts "[Yell] " + .join("\n") rescue Exception => e # do nothing end |
.env ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/yell.rb', line 80 def env return ENV['YELL_ENV'] if ENV.key? 'YELL_ENV' return ENV['RACK_ENV'] if ENV.key? 'RACK_ENV' return ENV['RAILS_ENV'] if ENV.key? 'RAILS_ENV' if defined?(Rails) Rails.env else 'development' end end |
.format(pattern = nil, date_pattern = nil, &block) ⇒ Yell::Formatter
Shortcut to Yell::Fomatter.new
63 64 65 |
# File 'lib/yell.rb', line 63 def format( pattern = nil, date_pattern = nil, &block ) Yell::Formatter.new(pattern, date_pattern, &block) end |
.level(val = nil) ⇒ Yell::Level
Shortcut to Yell::Level.new
42 43 44 |
# File 'lib/yell.rb', line 42 def level( val = nil ) Yell::Level.new(val) end |
.load!(file) ⇒ Yell::Logger
Loads a config from a YAML file
70 71 72 |
# File 'lib/yell.rb', line 70 def load!( file ) Yell.new Yell::Configuration.load!(file) end |
.new(*args, &block) ⇒ Yell::Logger
Creates a new logger instance.
Refer to #Yell::Loggger for usage.
35 36 37 |
# File 'lib/yell.rb', line 35 def new( *args, &block ) Yell::Logger.new(*args, &block) end |