class Loog::Tee

A combiner of a few logs together:

require 'loog'
tee = Loog::Tee.new(Loog::VERBOSE, file_logger)
log.info('Hello, world!')

This way you can log to console and to the file at the same time.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2018 Yegor Bugayenko

License

MIT

Public Class Methods

new(*logs) click to toggle source

Makes an instance.

# File lib/loog/tee.rb, line 40
def initialize(*logs)
  @logs = logs
end

Public Instance Methods

debug(msg) click to toggle source
# File lib/loog/tee.rb, line 44
def debug(msg)
  @logs.each { |g| g.debug(msg) }
end
debug?() click to toggle source
# File lib/loog/tee.rb, line 48
def debug?
  @logs.any? { |g| g.debug?(msg) }
end
error(msg) click to toggle source
# File lib/loog/tee.rb, line 60
def error(msg)
  @logs.each { |g| g.error(msg) }
end
info(msg) click to toggle source
# File lib/loog/tee.rb, line 52
def info(msg)
  @logs.each { |g| g.info(msg) }
end
info?() click to toggle source
# File lib/loog/tee.rb, line 56
def info?
  @logs.any? { |g| g.info?(msg) }
end