netuitive_ruby_api 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/agent.yml +4 -3
- data/lib/netuitive/netuitive_ruby_logger.rb +24 -0
- data/lib/netuitive/ruby_config_manager.rb +20 -37
- data/log/netuitive.log +0 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdb7b2af35219bd7735f5953d8379e944cc2b786
|
4
|
+
data.tar.gz: 44afde7b64728fca289807198c514e29ee18f6e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a738c8ceee614c0eb52321e579e7701ca0581e32f6a36579b29cab1e8d949d4b90181c360bde5fd583d77b3973d36c83cd766b565d81afd0a7dd8856607586
|
7
|
+
data.tar.gz: 5b1b029c6401fe183bb2a8f40a548044cb7c54e5489113037b70502c0fe7b1f667d218944162f3a8ac0a5525caa2bacad415622a85da1d8c73e380d926cae9e8
|
data/config/agent.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
#all are configurable using environment variables
|
2
|
+
debugLevel: info #options (in ascending order of debugness) are: error, info, debug. environment variable: NETUITIVE_RUBY_DEBUG_LEVEL
|
3
|
+
netuitivedAddr: localhost #environment variable: NETUITIVE_RUBY_NETUITIVED_ADDR
|
4
|
+
netuitivedPort: 8875 #environment variable: NETUITIVE_RUBY_NETUITIVED_PORT
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'logger'
|
2
|
+
class CheaterLogger
|
3
|
+
attr_accessor :level
|
4
|
+
def debug(message)
|
5
|
+
end
|
6
|
+
def error(message)
|
7
|
+
end
|
8
|
+
def info(message)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class NetuitiveLogger
|
13
|
+
begin
|
14
|
+
@@log = Logger.new("#{File.expand_path("../../..", __FILE__)}/log/netuitive.log",'daily', 10)
|
15
|
+
rescue
|
16
|
+
puts "netuitive unable to open log file"
|
17
|
+
@@log = CheaterLogger.new
|
18
|
+
end
|
19
|
+
class << self
|
20
|
+
def log
|
21
|
+
return @@log
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
|
+
require 'netuitive/netuitive_ruby_logger'
|
1
2
|
class ConfigManager
|
2
3
|
|
3
4
|
class << self
|
4
5
|
def setup()
|
5
|
-
@@error=0
|
6
|
-
@@info=1
|
7
|
-
@@debug=2
|
8
6
|
readConfig()
|
9
7
|
end
|
10
8
|
|
@@ -16,51 +14,36 @@ class ConfigManager
|
|
16
14
|
@@netuitivedPort
|
17
15
|
end
|
18
16
|
|
19
|
-
def isDebug?
|
20
|
-
if @@debugLevel >= @@debug
|
21
|
-
return true
|
22
|
-
end
|
23
|
-
return false
|
24
|
-
end
|
25
|
-
|
26
|
-
def isInfo?
|
27
|
-
if @@debugLevel >= @@info
|
28
|
-
return true
|
29
|
-
end
|
30
|
-
return false
|
31
|
-
end
|
32
|
-
|
33
|
-
def isError?
|
34
|
-
if @@debugLevel >= @@error
|
35
|
-
return true
|
36
|
-
end
|
37
|
-
return false
|
38
|
-
end
|
39
|
-
|
40
17
|
def readConfig()
|
41
18
|
gem_root= File.expand_path("../../..", __FILE__)
|
42
19
|
data=YAML.load_file "#{gem_root}/config/agent.yml"
|
43
|
-
@@netuitivedAddr=
|
44
|
-
@@
|
45
|
-
|
46
|
-
|
47
|
-
|
20
|
+
@@netuitivedAddr=ENV["NETUITIVE_RUBY_NETUITIVED_ADDR"]
|
21
|
+
if(@@netuitivedAddr == nil or @@netuitivedAddr == "")
|
22
|
+
@@netuitivedAddr=data["netuitivedAddr"]
|
23
|
+
end
|
24
|
+
@@netuitivedPort=ENV["NETUITIVE_RUBY_NETUITIVED_PORT"]
|
25
|
+
if(@@netuitivedPort == nil or @@netuitivedPort == "")
|
26
|
+
@@netuitivedPort=data["netuitivedPort"]
|
27
|
+
end
|
28
|
+
debugLevelString=ENV["NETUITIVE_RUBY_DEBUG_LEVEL"]
|
29
|
+
if(debugLevelString == nil or debugLevelString == "")
|
30
|
+
debugLevelString=data["debugLevel"]
|
31
|
+
end
|
32
|
+
NetuitiveLogger.log.info "port: #{@@netuitivedPort}"
|
33
|
+
NetuitiveLogger.log.info "addr: #{@@netuitivedAddr}"
|
48
34
|
if debugLevelString == "error"
|
49
|
-
|
35
|
+
NetuitiveLogger.log.level = Logger::ERROR
|
50
36
|
elsif debugLevelString == "info"
|
51
|
-
|
37
|
+
NetuitiveLogger.log.level = Logger::INFO
|
52
38
|
elsif debugLevelString == "debug"
|
53
|
-
|
39
|
+
NetuitiveLogger.log.level = Logger::DEBUG
|
54
40
|
else
|
55
|
-
|
41
|
+
NetuitiveLogger.log.level = Logger::ERROR
|
56
42
|
end
|
57
|
-
|
58
|
-
if isDebug?
|
59
|
-
puts "read config file. Results:
|
43
|
+
NetuitiveLogger.log.debug "read config file. Results:
|
60
44
|
netuitivedAddr: #{@@netuitivedAddr}
|
61
45
|
netuitivedPort: #{@@netuitivedPort}
|
62
46
|
debugLevel: #{debugLevelString}"
|
63
|
-
end
|
64
47
|
end
|
65
48
|
end
|
66
49
|
end
|
data/log/netuitive.log
ADDED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netuitive_ruby_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John King
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows for easy submittion of metrics to Netuitive
|
14
14
|
email: jking@netuitive.com
|
@@ -16,10 +16,12 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- lib/netuitive/netuitive_ruby_logger.rb
|
19
20
|
- lib/netuitive/ruby_config_manager.rb
|
20
21
|
- lib/netuitive_ruby_api.rb
|
21
22
|
- config/agent.yml
|
22
23
|
- "./LICENSE"
|
24
|
+
- log/netuitive.log
|
23
25
|
homepage: http://rubygems.org/gems/netuitive_ruby_api
|
24
26
|
licenses:
|
25
27
|
- Apache v2.0
|
@@ -32,7 +34,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
34
|
requirements:
|
33
35
|
- - ">="
|
34
36
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
37
|
+
version: 1.9.0
|
36
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
38
40
|
- - ">="
|