oml4r 2.10.1 → 2.10.2

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: b2360b53959ca90561c568582edbc71e7b21f840
4
- data.tar.gz: 058568d1d397366c4a0a8af0cba0ea0633eb154e
3
+ metadata.gz: ac0d927de25844aef4430946426fd21fb2996301
4
+ data.tar.gz: 869927e388d2c20e5533522cb3d041cf905637bf
5
5
  SHA512:
6
- metadata.gz: a2941e684c41b8843e64451f1108e3d2648ce5fac335dfdb6db6e83038dc55e62deab6063302c897709713c2eba5110fc9f72bfd7e38fb6f3c65367296275f07
7
- data.tar.gz: e5805b621d247a1b5104393b3f1f08d415eccc07199d73f38c84a31c4af62cd49ca4c16b778566db6c35565d5280ad5bc2ce17b99e65ecefd05682e13a660d2e
6
+ metadata.gz: cfbe00962c39cfcf23a05dff15a1f7c43868851783aa75702a88e351d9b259ab5bc4bb72e824cd5d07019abf5243ed251824563c44856141d92e578d276d5605
7
+ data.tar.gz: 2170da7ed5cb58fd6b0c2312aabffcfa2aa9dd7a8648810e3b64c7107f25ec2c91f03b4161759d54d42e1e3b91e227eaa365ed0da9e68fb305d9f3c7b434cce5
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'oml4r/logging/oml4r_appender'
4
+
5
+ appender = Logging.appenders.oml4r('oml4r',
6
+ :appName => 'log-tester',
7
+ :domain => 'foo',
8
+ :collect => 'file:-')
9
+
10
+ log = Logging.logger[self]
11
+ log.add_appenders 'oml4r'
12
+
13
+ log.info 'Info Message'
14
+ log.debug 'Debug Message'
15
+ log.info ({:a => 1, :b => 2, :c => 3})
16
+
17
+ appender.close
@@ -0,0 +1,50 @@
1
+ require 'logging'
2
+ require 'oml4r'
3
+
4
+ module Logging::Appenders
5
+
6
+ def self.oml4r *args
7
+ return Logging::Appenders::Oml4r if args.empty?
8
+ Logging::Appenders::Oml4r.new *args
9
+ end
10
+
11
+ class Oml4r < Logging::Appender
12
+
13
+ class LogMP < OML4R::MPBase
14
+ name :Log
15
+ param :data, :type => :string
16
+ param :file, :type => :string
17
+ param :level, :type => :string
18
+ param :line, :type => :string
19
+ param :logger, :type => :string
20
+ param :method, :type => :string
21
+ param :time, :type => :string
22
+ end
23
+
24
+ # pass a name and the usual OML options here to configure oml4r
25
+ def initialize *args
26
+ opts = Hash === args.last ? args.pop : {}
27
+ name = args.empty? ? 'oml4r' : args.shift
28
+ super(name, opts)
29
+ begin
30
+ OML4R::init(nil, opts)
31
+ rescue OML4R::MissingArgumentException => mex
32
+ $stderr.puts mex
33
+ exit
34
+ end
35
+ end
36
+
37
+ def close *args
38
+ super(false)
39
+ OML4R::close()
40
+ end
41
+
42
+ private
43
+
44
+ def write(event)
45
+ LogMP.inject(event.data,event.file,event.level,event.line,event.logger,event.method,event.time)
46
+ self
47
+ end
48
+
49
+ end # class Oml4r
50
+ end # module
data/lib/oml4r/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # ------------------
6
6
 
7
7
  module OML4R
8
- VERSION = "2.10.1"
8
+ VERSION = "2.10.2"
9
9
  VERSION_STRING = "OML4R Client V#{VERSION}"
10
10
  COPYRIGHT = "Copyright 2009-2014, NICTA"
11
11
  end
data/lib/oml4r.rb CHANGED
@@ -114,13 +114,15 @@ module OML4R
114
114
  # Set a metric for this MP
115
115
  # - name = name of the metric to set
116
116
  # - opts = a Hash with the options for this metric
117
- # Only supported option is :type = { :string | :int32 | :double | :bool | :guid }
117
+ # Only supported option is :type = { :string | :int32 | :uint32 | :int64 | :uint64 | :double | :bool | :guid |
118
+ # [ DEPRECATED :long | :integer ] }
118
119
  def self.param(name, opts = {})
119
120
  o = opts.dup
120
121
  o[:name] = name
121
122
  o[:type] ||= :string
122
- if :long == o[:type]
123
- OML4R.logger.warn ":long is deprecated use, :int32 instead"
123
+ if :long == o[:type] or :integer == o[:type]
124
+ # XXX: :name in :name... See #1527 bullet point 3
125
+ OML4R.logger.warn "Type #{o[:type]} for #{__def__()[:name][:name]}.#{o[:name]} is deprecated, use :int32 instead"
124
126
  o[:type] = :int32
125
127
  end
126
128
  __def__()[:p_def] << o
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oml4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.1
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - NICTA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-02-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: '["Simple OML client library and applications for Ruby"]'
14
14
  email:
@@ -40,6 +40,7 @@ files:
40
40
  - bin/oml4r-zabbix
41
41
  - bin/ping-oml2
42
42
  - bin/test_types
43
+ - examples/oml4r-logging.rb
43
44
  - examples/oml4r-multiple-channel-example.rb
44
45
  - examples/oml4r-neuca-beacon.rb
45
46
  - examples/oml4r-orca-beacon.rb
@@ -51,6 +52,7 @@ files:
51
52
  - lib/oml4r.rb
52
53
  - lib/oml4r/benchmark.rb
53
54
  - lib/oml4r/log4r/oml_outputter.rb
55
+ - lib/oml4r/logging/oml4r_appender.rb
54
56
  - lib/oml4r/version.rb
55
57
  - omf/README
56
58
  - omf/ping-oml2.app.rb
@@ -75,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
77
  version: '0'
76
78
  requirements: []
77
79
  rubyforge_project:
78
- rubygems_version: 2.2.1
80
+ rubygems_version: 2.0.6
79
81
  signing_key:
80
82
  specification_version: 4
81
83
  summary: '["This is a simple client library for OML which does not use liboml2 and
@@ -83,3 +85,4 @@ summary: '["This is a simple client library for OML which does not use liboml2 a
83
85
  can use this library to create ruby applications which can send measurement to the
84
86
  OML collection server. The gem ships with some example applications."]'
85
87
  test_files: []
88
+ has_rdoc: