context_logger 0.0.36 → 0.0.37
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.
- checksums.yaml +4 -4
- data/lib/context_logger.rb +4 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97dfb691f74245a1890f4fbc6026ed53d8b3b345
|
|
4
|
+
data.tar.gz: 3fd684d9a5c8fa0d6c013fc36a75ee7f2d359dc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03ac2ebc930ddbd4da194352474632009d600675e2b70a4f0932d850b5e4564248b41298bbeb7931e45cdfa254143c20ce48e2071516a02765dd84482fc0ba32
|
|
7
|
+
data.tar.gz: 12a7dfb77c158882b434392f9d1a3a9e2ad3c904bfea3edd0f5749a939337cc37a206e02c016cfa4538de28b8b11fb67133ae27b4c218b5be265f16dcb0975ca
|
data/lib/context_logger.rb
CHANGED
|
@@ -52,14 +52,13 @@ module ContextLogger
|
|
|
52
52
|
return @destinations
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
private
|
|
56
|
+
|
|
55
57
|
def self.logs_folder
|
|
56
58
|
# TODO: set the path from config
|
|
57
59
|
@logs_folder ||= "#{Rails.root}/log"
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
private
|
|
62
|
-
|
|
63
62
|
def self.log_file_path(current_context)
|
|
64
63
|
file_name = current_context.to_s.downcase.gsub(/ /, '_').gsub(/[^0-9a-z_]/, '')
|
|
65
64
|
return "#{logs_folder}/#{file_name}.log"
|
|
@@ -71,14 +70,10 @@ module ContextLogger
|
|
|
71
70
|
destinations.each do |log_destination, should_write_log|
|
|
72
71
|
self.send(log_destination, params_with_defaults) if should_write_log
|
|
73
72
|
end
|
|
74
|
-
|
|
75
|
-
# write_rails_log(params_with_defaults)
|
|
76
|
-
# write_context_log(params_with_defaults)
|
|
77
|
-
# write_db_log(params_with_defaults)
|
|
78
73
|
end
|
|
79
74
|
|
|
80
75
|
def self.logger_of_context(current_context)
|
|
81
|
-
@context_loggers[current_context] ||= Logger.new(log_file_path(current_context))
|
|
76
|
+
@context_loggers[current_context] ||= ::Logger.new(log_file_path(current_context))
|
|
82
77
|
end
|
|
83
78
|
|
|
84
79
|
def self.write_rails_log(params_with_defaults)
|
|
@@ -95,7 +90,7 @@ module ContextLogger
|
|
|
95
90
|
end
|
|
96
91
|
|
|
97
92
|
def self.db_log_columns
|
|
98
|
-
return @db_log_columns if @
|
|
93
|
+
return @db_log_columns if @db_log_columns
|
|
99
94
|
@db_log_columns = {}
|
|
100
95
|
::ContextLog.columns.each{|column| @db_log_columns[column.name.to_sym] = true}
|
|
101
96
|
return @db_log_columns
|