Commit 569c23798c73a68a89c81fdd01cdffc8f7c4ac16
1 parent
1aeb0d56
Exists in
master
and in
28 other branches
[spaminator] Moving spaminator lot to noosfero default log file
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
plugins/spaminator/lib/spaminator_plugin/spaminator.rb
... | ... | @@ -12,7 +12,10 @@ class SpaminatorPlugin::Spaminator |
12 | 12 | puts Benchmark.measure { run(environment) } |
13 | 13 | end |
14 | 14 | |
15 | - def initialize_logger(logpath) | |
15 | + def initialize_logger(environment) | |
16 | + logdir = File.join(RAILS_ROOT, 'log', SpaminatorPlugin.name.underscore) | |
17 | + File.makedirs(logdir) if !File.exist?(logdir) | |
18 | + logpath = File.join(logdir, "#{environment.name.to_slug}_#{ENV['RAILS_ENV']}_#{Time.now.strftime("%F_%T")}.log") | |
16 | 19 | @logger = Logger.new(logpath) |
17 | 20 | end |
18 | 21 | |
... | ... | @@ -28,8 +31,7 @@ class SpaminatorPlugin::Spaminator |
28 | 31 | @report = SpaminatorPlugin::Report.new(:environment => environment, |
29 | 32 | :total_people => Person.count, |
30 | 33 | :total_comments => Comment.count) |
31 | - logpath = File.join(SpaminatorPlugin.root_path, 'log', "#{environment.name.to_slug}_#{ENV['RAILS_ENV']}_#{Time.now.strftime("%F_%T")}.log") | |
32 | - self.class.initialize_logger(logpath) | |
34 | + self.class.initialize_logger(environment) | |
33 | 35 | end |
34 | 36 | |
35 | 37 | def run | ... | ... |