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.2.2"
- 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[]
46 47 48 |
# File 'lib/yell.rb', line 46 def []( name ) Yell::Repository[name] end |
.[]=(name, logger) ⇒ Yell::Logger
Shortcut to Yell::Repository[]=
53 54 55 |
# File 'lib/yell.rb', line 53 def []=( name, logger ) Yell::Repository[name] = logger end |
.__deprecate__(version, message, options = {}) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/yell.rb', line 90 def __deprecate__( version, , = {} ) #:nodoc: = ["Deprecation Warning (since v#{version}): #{}" ] << " before: #{[:before]}" if [:before] << " after: #{[:after]}" if [:after] __warn__(*) end |
.__fetch__(hash, *args) ⇒ Object
106 107 108 109 110 111 |
# File 'lib/yell.rb', line 106 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
99 100 101 102 103 |
# File 'lib/yell.rb', line 99 def __warn__( * ) #:nodoc: $stderr.puts "[Yell] " + .join("\n") rescue Exception => e # do nothing end |
.env ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/yell.rb', line 77 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
60 61 62 |
# File 'lib/yell.rb', line 60 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
39 40 41 |
# File 'lib/yell.rb', line 39 def level( val = nil ) Yell::Level.new(val) end |
.load!(file) ⇒ Yell::Logger
Loads a config from a YAML file
67 68 69 |
# File 'lib/yell.rb', line 67 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.
32 33 34 |
# File 'lib/yell.rb', line 32 def new( *args, &block ) Yell::Logger.new(*args, &block) end |