Class: Bizside::Audit::Logger
- Inherits:
-
Object
- Object
- Bizside::Audit::Logger
- Includes:
- Singleton
- Defined in:
- lib/bizside/audit/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
- #file_path ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #record(info = {}) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bizside/audit/logger.rb', line 14 def initialize path = file_path FileUtils.mkdir_p( File.dirname(path) ) file = File.open(path, 'a') file.sync = true @logger = ::Logger.new(file) @logger.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end end |
Class Method Details
.logger ⇒ Object
10 11 12 |
# File 'lib/bizside/audit/logger.rb', line 10 def self.logger self.instance end |
Instance Method Details
#file_path ⇒ Object
30 31 32 |
# File 'lib/bizside/audit/logger.rb', line 30 def file_path File.join('log', 'audit.log') end |
#record(info = {}) ⇒ Object
26 27 28 |
# File 'lib/bizside/audit/logger.rb', line 26 def record(info = {}) @logger.info LTSV.dump(info) end |