Add possibility to specify a different format for log
parent
4ebb0c52f1
commit
3310b4502c
|
@ -3,6 +3,14 @@ require "rails_big_brother/controller"
|
||||||
require "rails_big_brother/model"
|
require "rails_big_brother/model"
|
||||||
|
|
||||||
module RailsBigBrother
|
module RailsBigBrother
|
||||||
|
def format=(value)
|
||||||
|
@format = value
|
||||||
|
end
|
||||||
|
|
||||||
|
def format
|
||||||
|
@format ||= "%<big_brother>s;%<user>s;%<controller_info>s;%<class>s;%<id>s;%<action>s;%<args>s"
|
||||||
|
end
|
||||||
|
|
||||||
def user=(value)
|
def user=(value)
|
||||||
store[:user] = value
|
store[:user] = value
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,10 +43,16 @@ module RailsBigBrother
|
||||||
end
|
end
|
||||||
|
|
||||||
def big_brother_log(action, *args)
|
def big_brother_log(action, *args)
|
||||||
# TODO RailsBigBrother.format, RailsBigBrother.separator
|
Rails.logger.info RailsBigBrother.format %
|
||||||
Rails.logger.info "big_brother;#{RailsBigBrother.user};" <<
|
{
|
||||||
"#{RailsBigBrother.controller_info_string};" <<
|
big_brother: "big_brother",
|
||||||
"#{self.class.name};#{self.to_param};#{action};#{args.join(';')}"
|
user: RailsBigBrother.user,
|
||||||
|
controller_info: RailsBigBrother.controller_info_string,
|
||||||
|
class: self.class.name,
|
||||||
|
id: self.to_param,
|
||||||
|
action: action,
|
||||||
|
args: args.join(',')
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue