Sha256: 9f910c97f6fc7c0058dd98d3fd4acd887dc50540607daa691069e9d56dd4d841

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

# dbus/logger.rb - debug logging
#
# This file is part of the ruby-dbus project
# Copyright (C) 2012 Martin Vidner
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License, version 2.1 as published by the Free Software Foundation.
# See the file "COPYING" for the exact licensing terms.

require "logger"

module DBus
  # Get the logger for the DBus module.
  # The default one logs to STDERR,
  # with DEBUG if $DEBUG is set, otherwise INFO.
  def logger
    if @logger.nil?
      debug = $DEBUG || ENV["RUBY_DBUS_DEBUG"]
      @logger = Logger.new($stderr)
      @logger.level = debug ? Logger::DEBUG : Logger::INFO
    end
    @logger
  end
  module_function :logger

  # Set the logger for the DBus module
  def logger=(logger)
    @logger = logger
  end
  module_function :logger=
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-dbus-0.24.0 lib/dbus/logger.rb
ruby-dbus-0.23.1 lib/dbus/logger.rb
ruby-dbus-0.23.0.beta2 lib/dbus/logger.rb
ruby-dbus-0.23.0.beta1 lib/dbus/logger.rb