diff --git a/lib/rails_big_brother.rb b/lib/rails_big_brother.rb index cc4e37d..1ff3826 100644 --- a/lib/rails_big_brother.rb +++ b/lib/rails_big_brother.rb @@ -3,6 +3,14 @@ require "rails_big_brother/controller" require "rails_big_brother/model" module RailsBigBrother + def format=(value) + @format = value + end + + def format + @format ||= "%s;%s;%s;%s;%s;%s;%s" + end + def user=(value) store[:user] = value end diff --git a/lib/rails_big_brother/model.rb b/lib/rails_big_brother/model.rb index 1f4d778..18d7e24 100644 --- a/lib/rails_big_brother/model.rb +++ b/lib/rails_big_brother/model.rb @@ -43,10 +43,16 @@ module RailsBigBrother end def big_brother_log(action, *args) - # TODO RailsBigBrother.format, RailsBigBrother.separator - Rails.logger.info "big_brother;#{RailsBigBrother.user};" << - "#{RailsBigBrother.controller_info_string};" << - "#{self.class.name};#{self.to_param};#{action};#{args.join(';')}" + Rails.logger.info RailsBigBrother.format % + { + big_brother: "big_brother", + 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