customlogger 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/README.md +24 -16
- data/lib/customlogger.rb +9 -1
- data/lib/customlogger/html_template.rb +3 -3
- data/lib/customlogger/version.rb +1 -1
- data/spec/customlogger_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7f7cadee874eef29a8a603afa95eb5388a7494b
|
4
|
+
data.tar.gz: 41cd2f51977bce9c266d6800b9602800ada0bada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706c05805cdae0ab622e339b259ce4a42b1f9e9defc116863dcd704a6b38b45ce6f7d53a21d2dea961dadb239bc1189d4e48fa8613e1e30bda3acbd7706cc8f8
|
7
|
+
data.tar.gz: f281c61f0dfa484b44733a4002f03db3e6f4ca634727f72d3f145f711895662040b9508ad3b85afeb762af51deb5195e0e05f7160eb41d92a77179bbdc3ac4db
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
[](http://badge.fury.io/rb/customlogger)
|
4
4
|
[](https://travis-ci.org/SaimonL/CustomLogger)
|
5
5
|
|
6
|
-
Custom logger allows you to log you're debug
|
7
|
-
view them in much more easier way.
|
8
|
-
|
6
|
+
Custom logger allows you to log you're debug information to an html file so you can
|
7
|
+
view them in much more easier way. All you need to do is include the gem in the
|
8
|
+
Gemfile and then use it directly CustomLogger.
|
9
9
|
|
10
10
|
## Compatable
|
11
11
|
|
12
|
-
CustomLogger is
|
12
|
+
CustomLogger is compatible with Ruby 1.9 and above. As for Rails 3.x and up.
|
13
13
|
You should not be using or have Ruby 1.8 installed for obvious reasons.
|
14
14
|
|
15
15
|
## Installation
|
@@ -36,7 +36,7 @@ Or install it yourself as:
|
|
36
36
|
## Usage
|
37
37
|
|
38
38
|
Custom Logger is very easy to use. Just use the module 'CustomLogger' anywhere
|
39
|
-
and log the message in a nice
|
39
|
+
and log the message in a nice friendly colorful html page view. Take a look
|
40
40
|
at the examples below.
|
41
41
|
|
42
42
|

|
@@ -51,17 +51,17 @@ at the examples below.
|
|
51
51
|
|
52
52
|
#### Log warning
|
53
53
|
|
54
|
-
CustomLogger.warning 'This is
|
55
|
-
CustomLogger.warning = 'This is
|
56
|
-
CustomLogger.warning 'This is
|
54
|
+
CustomLogger.warning 'This is a warning message'
|
55
|
+
CustomLogger.warning = 'This is a warning message'
|
56
|
+
CustomLogger.warning 'This is a warning message', 'Warning Title'
|
57
57
|
|
58
58
|

|
59
59
|
|
60
60
|
#### Log debug
|
61
61
|
|
62
|
-
CustomLogger.debug 'This is
|
63
|
-
CustomLogger.debug = 'This is
|
64
|
-
CustomLogger.debug 'This is
|
62
|
+
CustomLogger.debug 'This is a debug message'
|
63
|
+
CustomLogger.debug = 'This is a debug message'
|
64
|
+
CustomLogger.debug 'This is a debug message', 'Debug Title'
|
65
65
|
|
66
66
|

|
67
67
|
|
@@ -79,16 +79,24 @@ Keep in mind that raw means that no formatting is applied so if the output
|
|
79
79
|
is 1000 characters horizontal without any line break then that is what you
|
80
80
|
will see. Basically it is inside of a 'pre' html tag.
|
81
81
|
|
82
|
-
CustomLogger.raw 'This is
|
83
|
-
CustomLogger.raw = 'This is
|
84
|
-
CustomLogger.raw 'This is
|
82
|
+
CustomLogger.raw 'This is a raw message'
|
83
|
+
CustomLogger.raw = 'This is a raw message'
|
84
|
+
CustomLogger.raw 'This is a raw message', 'Raw Title'
|
85
85
|
|
86
86
|

|
87
87
|
|
88
|
-
####
|
88
|
+
#### New Line
|
89
|
+
|
90
|
+
If you want to add a gap in-between sets of outputs then this is what you are
|
91
|
+
looking for.
|
92
|
+
|
93
|
+
CustomLogger.new_line
|
89
94
|
|
90
|
-
|
95
|
+

|
96
|
+
|
97
|
+
#### Clear All Logs
|
91
98
|
|
99
|
+
CustomLogger.clear
|
92
100
|
|
93
101
|
## Log File
|
94
102
|
|
data/lib/customlogger.rb
CHANGED
@@ -107,7 +107,7 @@ module CustomLogger
|
|
107
107
|
private
|
108
108
|
def set_error_colors
|
109
109
|
@error_colors = {
|
110
|
-
error: '#8b0000', warning: '#
|
110
|
+
error: '#8b0000', warning: '#6d422e',
|
111
111
|
debug: '#2d5a2e', info: '#31708f'
|
112
112
|
}
|
113
113
|
end
|
@@ -119,6 +119,14 @@ module CustomLogger
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def log(state, message, title = nil)
|
122
|
+
if !title.nil? && !title.is_a?(String)
|
123
|
+
title = title.inspect
|
124
|
+
end
|
125
|
+
|
126
|
+
unless %w(Array Hash String).include?(message.class.name)
|
127
|
+
message = message.inspect
|
128
|
+
end
|
129
|
+
|
122
130
|
if @logged_total.nil?
|
123
131
|
@logged_total = 0
|
124
132
|
else
|
@@ -36,10 +36,10 @@ class HTMLTemplate
|
|
36
36
|
font-family: monospace, monospace, serif;
|
37
37
|
font-size: 0.9em;
|
38
38
|
color: #{error_colors[:warning]};
|
39
|
-
background-color: #
|
40
|
-
border-color: #
|
39
|
+
background-color: #faebcc;
|
40
|
+
border-color: #b4a48a;
|
41
41
|
padding: 8px;
|
42
|
-
border: 1px solid #
|
42
|
+
border: 1px solid #b4a48a;
|
43
43
|
border-radius: 4px;
|
44
44
|
margin-bottom: 4px;
|
45
45
|
}
|
data/lib/customlogger/version.rb
CHANGED
data/spec/customlogger_spec.rb
CHANGED
@@ -38,14 +38,14 @@ describe 'with Custom Logger' do
|
|
38
38
|
describe 'with error colors' do
|
39
39
|
it 'will have default error colors' do
|
40
40
|
expect( CustomLogger.error_colors
|
41
|
-
).to eq ({ error: '#8b0000', warning: '#
|
41
|
+
).to eq ({ error: '#8b0000', warning: '#6d422e', debug: '#2d5a2e',
|
42
42
|
info: '#31708f' })
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'will allow to set error color' do
|
46
46
|
CustomLogger.error_color(:error, 'lovell')
|
47
47
|
expect( CustomLogger.error_colors
|
48
|
-
).to eq ({ error: 'lovell', warning: '#
|
48
|
+
).to eq ({ error: 'lovell', warning: '#6d422e', debug: '#2d5a2e',
|
49
49
|
info: '#31708f' })
|
50
50
|
end
|
51
51
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: customlogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saimon Lovell
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.4.
|
98
|
+
rubygems_version: 2.4.5
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Log output in to a seperate html file.
|