simplesyslogger 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2363327adfe64a3530661375c3881e86312b36b
4
- data.tar.gz: 92e7518e23a878450467a96c8c58a39f46878ec3
3
+ metadata.gz: cbb957b034d37818b2631c18b54bbc44cd8876c6
4
+ data.tar.gz: c49f9a46a03c18a992a982ca2e822cca2e52c87e
5
5
  SHA512:
6
- metadata.gz: d7cf8b4da479773a6ac70b1194f9cf1516116208b11d93cc91209beb5073463c487d3627c42e99a7182108099a24d175b25e5b198a0059da8dab5e4397b17627
7
- data.tar.gz: d578de110c485f7021f0abd8f0409c432fcde85d681b4a0cc66bfe2a236a3982b2cbbf38b9d2a9b5731990b87299c71bf4e43896734f20f05b2b9b494627052e
6
+ metadata.gz: 2b7882dc7673895398dacc39f7d189582c951d87e534be9634d9d773f63ce5f2df46dfce48f45c7ad5741e135c5c8b33a4c49937656307ee41ed007b65eaf429
7
+ data.tar.gz: 21c1b2c5b2ffab0a61ba5a6976736f9d7581d9dc47cefd1d251f17b66bb1a4686aba8ab693fbdfa66ba692c7116de61d31e847dfa6000d2b61eed23aded73a6c
data/README.md CHANGED
@@ -21,8 +21,11 @@ Or install it yourself as:
21
21
  Example usage in sinatra:
22
22
 
23
23
  configure do
24
- log = SimpleSysLogger::Logger.new("MY_COOL_APP", Syslog::LOG_PID, Syslog::LOG_LOCAL0)
25
- TODO:// # logging level - i.e. send messages that are at least of the Logger::INFO level - not fully implemented yet
24
+ log = SimpleSysLogger::SysLogger.new({
25
+ :ident => "MY_COOL_APPNAME",
26
+ :level => Logger::DEBUG #TODO:// # logging level - i.e. send messages that are at least of the Logger::INFO level - not fully implemented yet
27
+ })
28
+
26
29
  log.level = ENV['RACK_ENV'] == 'production' ? Logger::INFO : Logger::DEBUG
27
30
  end
28
31
 
@@ -1,3 +1,3 @@
1
1
  module Simplesyslogger
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,8 +1,10 @@
1
+ require 'logger'
2
+ require 'syslog'
1
3
  require "simplesyslogger/version"
2
4
 
3
5
  module SimpleSysLogger
4
6
 
5
- class Logger
7
+ class SysLogger
6
8
 
7
9
  attr_reader :level, :ident, :options, :facility
8
10
 
@@ -15,13 +17,11 @@ module SimpleSysLogger
15
17
  Logger::UNKNOWN => "alert"
16
18
  }
17
19
 
18
-
19
- def initialize(ident = $0, options = Syslog::LOG_PID | Syslog::LOG_CONS, facility = nil)
20
- puts "initialize syslogger"
21
- @ident = ident
22
- @options = options || (Syslog::LOG_PID | Syslog::LOG_CONS)
23
- @level = Logger::INFO
24
- @facility = @facility
20
+ def initialize(opts = {})
21
+ @ident = opts[:ident] || $0
22
+ @options = opts[:options] || (Syslog::LOG_PID | Syslog::LOG_CONS)
23
+ @level = opts[:level]|| Logger::INFO
24
+ @facility = opts[:facility] || Syslog::LOG_LOCAL0
25
25
  end
26
26
 
27
27
 
@@ -58,7 +58,7 @@ module SimpleSysLogger
58
58
  # +progname+:: optionally, overwrite the program name that appears in the log message.
59
59
  def add(severity, message = nil, progname = nil, &block)
60
60
  formatted_communication = "=====> #{MAPPING[severity]} :::: #{message}"
61
- Syslog.open(progname || @ident, Syslog::LOG_PID | Syslog::LOG_CONS) { |s|
61
+ Syslog.open(progname || @ident, @options) { |s|
62
62
  puts "#{MAPPING[severity]} ..... logger:::: #{formatted_communication}"
63
63
  #s.warning "logger:::: #{formatted_communication}"
64
64
  s.send("#{MAPPING[severity]}".to_sym, formatted_communication)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplesyslogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fritz G. Batroni