Sha256: 19ff47f7c789b9867309113d7ca1c1cb2c43d1115867f437ddebf20087fc3091

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

module LoggingLibrary
  #
  # Module responsible for instantiating logger objects.
  #
  module LoggerFactory
    module_function

    # Creates a new `Logger` object.
    #
    # @param name [String] Optional name of the logger. If not provided, a
    #                      default will be determined from backtrace.
    #
    # @return [Logger]
    def create(name = nil)
      logger_name = name || caller(1..1).first[/`(.+)'/, 1]
      Logger.new(logger_name)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logging_library-1.3.0 lib/logging_library/logger_factory.rb
logging_library-1.2.0 lib/logging_library/logger_factory.rb