Class: Jiragit::Logger
- Inherits:
-
Logger
- Object
- Logger
- Jiragit::Logger
- Defined in:
- lib/jiragit/logger.rb
Instance Attribute Summary collapse
-
#hook ⇒ Object
Returns the value of attribute hook.
Instance Method Summary collapse
- #directory ⇒ Object
- #format_message(severity, datetime, progname, msg) ⇒ Object
-
#initialize(path = nil) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(path = nil) ⇒ Logger
Returns a new instance of Logger.
10 11 12 13 14 15 16 17 18 |
# File 'lib/jiragit/logger.rb', line 10 def initialize(path = nil) if path @path = path else @path = ".git/jiragit/jiragit.log" end FileUtils.mkdir_p directory super(@path) end |
Instance Attribute Details
#hook ⇒ Object
Returns the value of attribute hook.
8 9 10 |
# File 'lib/jiragit/logger.rb', line 8 def hook @hook end |
Instance Method Details
#directory ⇒ Object
24 25 26 27 28 |
# File 'lib/jiragit/logger.rb', line 24 def directory dir = @path.gsub(/(^|\/)[^\/]*?$/,'') dir = "." if dir == '' dir end |
#format_message(severity, datetime, progname, msg) ⇒ Object
20 21 22 |
# File 'lib/jiragit/logger.rb', line 20 def (severity, datetime, progname, msg) "#{datetime} #{@hook}: #{msg}\n" end |