td-logger 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6 -0
- data/VERSION +1 -1
- data/lib/td/logger/agent/rails/config.rb +19 -14
- data/lib/td/logger/version.rb +1 -1
- metadata +1 -1
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.14
|
@@ -47,36 +47,41 @@ module Agent::Rails
|
|
47
47
|
|
48
48
|
def self.init
|
49
49
|
logger = ::Logger.new(STDERR)
|
50
|
-
|
51
|
-
|
50
|
+
|
51
|
+
if CONFIG_PATH[0] == ?/
|
52
|
+
config_path = CONFIG_PATH
|
52
53
|
else
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
config_path = "#{::Rails.root}/#{CONFIG_PATH}"
|
55
|
+
end
|
56
|
+
|
57
|
+
if File.exist?(config_path)
|
58
|
+
load_file(logger, config_path)
|
59
|
+
elsif File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
|
60
|
+
load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_DEPLOY}")
|
61
|
+
elsif File.exist?("#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
|
62
|
+
load_file_ey(logger, "#{::Rails.root}/#{CONFIG_PATH_EY_LOCAL}")
|
63
|
+
else
|
64
|
+
load_env(logger)
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
63
|
-
def self.load_file(logger)
|
68
|
+
def self.load_file(logger, path="#{::Rails.root}/#{CONFIG_PATH}")
|
64
69
|
require 'yaml'
|
65
70
|
require 'erb'
|
66
71
|
|
67
72
|
begin
|
68
|
-
src = File.read(
|
73
|
+
src = File.read(path)
|
69
74
|
yaml = ERB.new(src).result
|
70
75
|
env_conf = YAML.load(yaml)
|
71
76
|
rescue
|
72
|
-
logger.warn "WARNING: Can't load #{
|
77
|
+
logger.warn "WARNING: Can't load #{path} file: #{$!}"
|
73
78
|
logger.warn "WARNING: Disabling Treasure Data event logger."
|
74
79
|
return nil
|
75
80
|
end
|
76
81
|
|
77
82
|
conf = env_conf[::Rails.env] if env_conf.is_a?(Hash)
|
78
83
|
unless conf
|
79
|
-
logger.warn "WARNING: #{
|
84
|
+
logger.warn "WARNING: #{path} doesn't include setting for current environment (#{::Rails.env})."
|
80
85
|
logger.warn "WARNING: Disabling Treasure Data event logger."
|
81
86
|
return nil
|
82
87
|
end
|
@@ -84,7 +89,7 @@ module Agent::Rails
|
|
84
89
|
begin
|
85
90
|
return Config.new(conf)
|
86
91
|
rescue
|
87
|
-
logger.warn "WARNING: #{
|
92
|
+
logger.warn "WARNING: #{path}: #{$!}."
|
88
93
|
logger.warn "WARNING: Disabling Treasure Data event logger."
|
89
94
|
return nil
|
90
95
|
end
|
data/lib/td/logger/version.rb
CHANGED