ultimate-log-silencer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ultimate Log Silencer
|
2
2
|
|
3
|
-
Ultimate Log Silencer mutes assets pipeline log-messages, sort of:
|
3
|
+
Ultimate Log Silencer can clear development logs and mutes assets pipeline log-messages, sort of:
|
4
4
|
|
5
5
|
```log
|
6
6
|
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-02-13 13:24:04 +0400
|
@@ -34,6 +34,10 @@ config.ultimate_log_silencer.assets_logger_off = false
|
|
34
34
|
config.ultimate_log_silencer.rack_logger_assets_off = true
|
35
35
|
# RegExp for detect request to assets.
|
36
36
|
config.ultimate_log_silencer.assets_path_regexp = /^\/assets\//
|
37
|
+
# Allow remove logs exceeded max_log_size.
|
38
|
+
config.ultimate_log_silencer.clear_logs = false
|
39
|
+
# Max allowed log size.
|
40
|
+
config.ultimate_log_silencer.max_log_size = 2.megabytes
|
37
41
|
```
|
38
42
|
|
39
43
|
## License
|
@@ -0,0 +1,12 @@
|
|
1
|
+
if Rails.application.config.ultimate_log_silencer.clear_logs
|
2
|
+
include ActionView::Helpers::NumberHelper
|
3
|
+
logs = File.join(Rails.root, 'log', '*.log')
|
4
|
+
Dir[logs].each do |log|
|
5
|
+
file_size = File.size? log
|
6
|
+
if file_size.to_i > Rails.application.config.ultimate_log_silencer.max_log_size
|
7
|
+
$stdout.puts "=> Ultimate Log Silencer: clearing #{log.gsub Rails.root.to_s, ''} (#{number_to_human_size file_size})"
|
8
|
+
f = File.open log, "w"
|
9
|
+
f.close
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -12,11 +12,19 @@ module Ultimate
|
|
12
12
|
# RegExp for detect request to assets.
|
13
13
|
attr_accessor :assets_path_regexp
|
14
14
|
|
15
|
+
# Allow remove logs exceeded max_log_size.
|
16
|
+
attr_accessor :clear_logs
|
17
|
+
|
18
|
+
# Max allowed log size.
|
19
|
+
attr_accessor :max_log_size
|
20
|
+
|
15
21
|
def initialize
|
16
22
|
# Set configuration defaults.
|
17
23
|
@assets_logger_off = false
|
18
24
|
@rack_logger_assets_off = true
|
19
25
|
@assets_path_regexp = /^\/assets\//
|
26
|
+
@clear_logs = false
|
27
|
+
@max_log_size = 2.megabytes
|
20
28
|
end
|
21
29
|
|
22
30
|
end
|
@@ -5,8 +5,8 @@ module Ultimate
|
|
5
5
|
module Silencer
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
config.ultimate_log_silencer = Ultimate::Log::Silencer::Configuration.new
|
8
|
-
|
9
8
|
initializer "ultimate-log-sillencer.quiet_assets", :after => "sprockets.environment" do
|
9
|
+
require "ultimate-log-silencer/clear_logs"
|
10
10
|
require "ultimate-log-silencer/quiet_assets"
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultimate-log-silencer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &18755440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18755440
|
25
25
|
description: Ultimate Log Silencer mutes assets pipeline log-messages.
|
26
26
|
email:
|
27
27
|
- koderfunk@gmail.com
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
37
|
- lib/ultimate-log-silencer.rb
|
38
|
+
- lib/ultimate-log-silencer/clear_logs.rb
|
38
39
|
- lib/ultimate-log-silencer/configuration.rb
|
39
40
|
- lib/ultimate-log-silencer/engine.rb
|
40
41
|
- lib/ultimate-log-silencer/quiet_assets.rb
|