Module: Sensu::Logger
- Defined in:
- lib/sensu/logger.rb,
lib/sensu/logger/stream.rb,
lib/sensu/logger/constants.rb
Defined Under Namespace
Classes: Stream
Constant Summary collapse
- LEVELS =
[:debug, :info, :warn, :error, :fatal]
Class Method Summary collapse
-
.get(options = {}) ⇒ Stream
Retrieve the current log stream or set one up if there isn’t one.
-
.setup(options = {}) ⇒ Stream
Setup a log stream.
Class Method Details
.get(options = {}) ⇒ Stream
Retrieve the current log stream or set one up if there isn’t one. Note: We may need to add a mutex for thread safety.
28 29 30 |
# File 'lib/sensu/logger.rb', line 28 def get(={}) @stream || setup() end |
.setup(options = {}) ⇒ Stream
Setup a log stream.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sensu/logger.rb', line 12 def setup(={}) @stream = Stream.new if [:log_level] @stream.level = [:log_level] end if [:log_file] @stream.reopen([:log_file]) end @stream end |