Sha256: 5308dd21977111cdc09a3b88ae3f2745ba4bea6fd999a8ec095df80493efa7e5

Contents?: true

Size: 721 Bytes

Versions: 12

Compression:

Stored size: 721 Bytes

Contents

# Class For Log to /var/log/system.log
# @author modeverv@gmail.com
# @example
#   MyLogger.ln("message")
#   MyLogger.lw("message")
class MyLogger

  Version = "0.0.1"    

  # log notice
  # @param [String] message message for log
  def self.ln(message)
    self.before
    Syslog.log(Syslog::LOG_NOTICE, "%s", message)
    self.after
  end
  
  # log warning
  # @param [String] message message for log
  def self.lw(message)
    self.before
    Syslog.log(Syslog::LOG_WARNING, "%s", message)
    self.after
  end
  
private
  # open syslog
  def self.before
    require 'syslog'
    include Syslog::Constants
    Syslog.open("ruby_syslog.rb")
  end
  # close syslog
  def self.after
    Syslog.close();
  end
  
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
my-lib-0.2.5 lib/lib/mylogger.rb
my-lib-0.2.4 lib/lib/mylogger.rb
my-lib-0.2.3 lib/lib/mylogger.rb
my-lib-0.2.2 lib/lib/mylogger.rb
my-lib-0.2.1 lib/lib/mylogger.rb
my-lib-0.0.2.0 lib/lib/mylogger.rb
my-lib-0.0.1.8 lib/lib/mylogger.rb
my-lib-0.0.1.7 lib/lib/mylogger.rb
my-lib-0.0.1.6 lib/lib/mylogger.rb
my-lib-0.0.1.5 lib/lib/mylogger.rb
my-lib-0.0.1.4 lib/lib/mylogger.rb
my-lib-0.0.1.3 lib/lib/mylogger.rb