Class: Ixtlan::AuditConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/ixtlan/audit_config.rb

Class Method Summary collapse

Class Method Details

.configure(keep, file, categories) ⇒ Object



8
9
10
11
# File 'lib/ixtlan/audit_config.rb', line 8

def self.configure(keep, file, categories)
  @@categories = categories
  reconfigure(keep, file)
end

.reconfigure(keep, file) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ixtlan/audit_config.rb', line 13

def self.reconfigure(keep, file)
  audit_appender =
    RollingFile.new('audit',
                    { :filename_base => file,
                      :keep => keep,
                      :safe => true,
                      :layout => Logging::Layouts::Pattern.new(:pattern => "%d %m\n") }
                    )

  @@categories.each do |category|
    logger = Logging::Logger[category]
    logger.remove_appenders('audit')
    logger.add_appenders(audit_appender)
    @logger.debug("setup logger for #{category}")
  end
  @logger.info("initialized audit log . . .")
end