syslog_client 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,16 +3,21 @@ require 'logglier'
3
3
  module SyslogClient
4
4
  class Base
5
5
  cattr_accessor :logger
6
- @@logger = Logglier.new('udp://192.168.2.180:8080', :format => :json)
6
+ @@logger = Logglier.new('udp://192.168.2.180:8080')
7
7
 
8
8
  class << self
9
9
  def send_log(options)
10
10
  infos = log_of_options(options)
11
11
  infos = infos.is_a?(::Array) ? infos : [infos]
12
12
 
13
- now = Time.now
13
+ now = Time.now.strftime('%Y-%m-%d %H:%M:%S')
14
14
  infos.each do |info|
15
- @@logger.info(info.reverse_merge(:operation_time => now))
15
+ if info[:operation_time] && info[:operation_time].respond_to?(:strftime)
16
+ info[:operation_time] = info[:operation_time].strftime('%Y-%m-%d %H:%M:%S')
17
+ else
18
+ info[:operation_time] = now
19
+ end
20
+ @@logger.info(info.to_json)
16
21
  end
17
22
  end
18
23
  end
@@ -1,3 +1,3 @@
1
1
  module SyslogClient
2
- Version = VERSION = '0.1.1'
2
+ Version = VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syslog_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: