logutils 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +5 -0
- data/README.md +6 -4
- data/lib/logutils.rb +2 -14
- data/lib/logutils/server.rb +57 -0
- data/lib/logutils/server/public/style.css +49 -0
- data/lib/logutils/server/views/_version.erb +5 -0
- data/lib/logutils/server/views/index.erb +26 -0
- data/lib/logutils/server/views/layout.erb +15 -0
- data/lib/logutils/version.rb +1 -1
- metadata +11 -6
data/Manifest.txt
CHANGED
@@ -8,6 +8,11 @@ lib/logutils/db/deleter.rb
|
|
8
8
|
lib/logutils/db/models.rb
|
9
9
|
lib/logutils/db/schema.rb
|
10
10
|
lib/logutils/logger.rb
|
11
|
+
lib/logutils/server.rb
|
12
|
+
lib/logutils/server/public/style.css
|
13
|
+
lib/logutils/server/views/_version.erb
|
14
|
+
lib/logutils/server/views/index.erb
|
15
|
+
lib/logutils/server/views/layout.erb
|
11
16
|
lib/logutils/version.rb
|
12
17
|
test/helper.rb
|
13
18
|
test/test_logger.rb
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
# logutils
|
1
|
+
# logutils - Another Logger in Ruby
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/geraldb/logutils.png?branch=master)](http://travis-ci.org/geraldb/logutils)
|
4
4
|
|
5
|
-
|
5
|
+
* home :: [github.com/geraldb/logutils](https://github.com/geraldb/logutils)
|
6
|
+
* bugs :: [github.com/geraldb/logutils/issues](https://github.com/geraldb/logutils)
|
7
|
+
* gem :: [rubygems.org/gems/logutils](https://rubygems.org/gems/logutils)
|
8
|
+
* rdoc :: [rubydoc.info/gems/logutils](http://rubydoc.info/gems/logutils)
|
6
9
|
|
7
|
-
* [github.com/geraldb/logutils](https://github.com/geraldb/logutils)
|
8
10
|
|
9
11
|
## Usage
|
10
12
|
|
@@ -132,7 +134,7 @@ in Ruby on Rails (version 3.2 and up).
|
|
132
134
|
|
133
135
|
## Todos
|
134
136
|
|
135
|
-
- [ ] Add
|
137
|
+
- [ ] Add TRACE level - why? why not? check std logger
|
136
138
|
|
137
139
|
|
138
140
|
## Alternatives
|
data/lib/logutils.rb
CHANGED
@@ -21,33 +21,22 @@ require 'logutils/logger'
|
|
21
21
|
|
22
22
|
|
23
23
|
module LogKernel
|
24
|
-
=begin # not needed for now; keep it for later
|
25
24
|
|
26
25
|
def self.root
|
27
26
|
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
|
28
27
|
end
|
29
28
|
|
29
|
+
=begin # not needed for now; keep it for later
|
30
30
|
def self.config_path
|
31
31
|
"#{root}/config"
|
32
32
|
end
|
33
|
-
|
34
33
|
=end
|
34
|
+
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
38
|
module LogUtils
|
39
39
|
|
40
|
-
###########
|
41
|
-
# deprecated - remove old api!!!
|
42
|
-
|
43
|
-
def self.[]( class_or_name )
|
44
|
-
|
45
|
-
puts "depreceated API call LogUtils[] - use Logger[] / LogUtils::Logger[] instead"
|
46
|
-
|
47
|
-
# for now always return single instance, that is, use standard/default logger for all
|
48
|
-
LogKernel::STDLOGGER
|
49
|
-
end
|
50
|
-
|
51
40
|
###################################
|
52
41
|
# export public api from kernel
|
53
42
|
|
@@ -60,7 +49,6 @@ module LogUtils
|
|
60
49
|
|
61
50
|
Logger = LogKernel::Logger
|
62
51
|
|
63
|
-
|
64
52
|
#####
|
65
53
|
# use it like
|
66
54
|
#
|
@@ -0,0 +1,57 @@
|
|
1
|
+
######
|
2
|
+
# NB: use rackup to startup Sinatra service (see config.ru)
|
3
|
+
#
|
4
|
+
# e.g. config.ru:
|
5
|
+
# require './boot'
|
6
|
+
# run LogDb::Server
|
7
|
+
|
8
|
+
|
9
|
+
# 3rd party libs/gems
|
10
|
+
|
11
|
+
require 'sinatra/base'
|
12
|
+
|
13
|
+
# our own code
|
14
|
+
|
15
|
+
require 'logutils'
|
16
|
+
require 'logutils/db'
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
module LogDb
|
21
|
+
|
22
|
+
class Server < Sinatra::Base
|
23
|
+
|
24
|
+
def self.banner
|
25
|
+
"logdb-server #{LogKernel::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
|
26
|
+
end
|
27
|
+
|
28
|
+
PUBLIC_FOLDER = "#{LogKernel.root}/lib/logutils/server/public"
|
29
|
+
VIEWS_FOLDER = "#{LogKernel.root}/lib/logutils/server/views"
|
30
|
+
|
31
|
+
puts "setting public folder to: #{PUBLIC_FOLDER}"
|
32
|
+
puts "setting views folder to: #{VIEWS_FOLDER}"
|
33
|
+
|
34
|
+
set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
|
35
|
+
set :views, VIEWS_FOLDER # set up the views dir
|
36
|
+
|
37
|
+
set :static, true # set up static file routing
|
38
|
+
|
39
|
+
|
40
|
+
#####################
|
41
|
+
# Models
|
42
|
+
|
43
|
+
include LogDb::Models
|
44
|
+
|
45
|
+
##############################################
|
46
|
+
# Controllers / Routing / Request Handlers
|
47
|
+
|
48
|
+
get '/' do
|
49
|
+
erb :index
|
50
|
+
end
|
51
|
+
|
52
|
+
end # class Server
|
53
|
+
end # module LogDb
|
54
|
+
|
55
|
+
|
56
|
+
# say hello
|
57
|
+
puts LogDb::Server.banner
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
body { font-family: arial,verdana,helvetica; }
|
4
|
+
|
5
|
+
.log-id,
|
6
|
+
.log-pid,
|
7
|
+
.log-created-at { font-size: 60%; color: grey; }
|
8
|
+
|
9
|
+
.log-id { text-align: right; }
|
10
|
+
|
11
|
+
.log-level,
|
12
|
+
.log-msg { font-size: 80%; }
|
13
|
+
|
14
|
+
.log-created-at,
|
15
|
+
.log-pid,
|
16
|
+
.log-msg { white-space: nowrap; }
|
17
|
+
|
18
|
+
.log-level { font-weight: bold; }
|
19
|
+
|
20
|
+
.log-msg.warn { font-weight: bold; }
|
21
|
+
|
22
|
+
|
23
|
+
/****
|
24
|
+
* links
|
25
|
+
*/
|
26
|
+
|
27
|
+
a {
|
28
|
+
color: black;
|
29
|
+
text-decoration: none; }
|
30
|
+
a:hover {
|
31
|
+
color: black;
|
32
|
+
background-color: aqua;
|
33
|
+
text-decoration: underline; }
|
34
|
+
a:visited {
|
35
|
+
color: black; }
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
/**********
|
40
|
+
* version / powered by
|
41
|
+
*/
|
42
|
+
|
43
|
+
.version {
|
44
|
+
text-align: center;
|
45
|
+
margin-top: 10px;
|
46
|
+
color: grey; }
|
47
|
+
.version a, .version span {
|
48
|
+
font-size: 12px;
|
49
|
+
color: grey; }
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class='version'>
|
2
|
+
<a href="https://github.com/geraldb/logutils">log.db/<%= LogKernel::VERSION %></a> -
|
3
|
+
<span>Ruby/<%= "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM})" %> on</span>
|
4
|
+
<span>Sinatra/<%= Sinatra::VERSION %> (<%= ENV['RACK_ENV'] %>)</span>
|
5
|
+
</div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
<h3><%= Log.count %> Logs</h3>
|
3
|
+
|
4
|
+
<!-- todo:
|
5
|
+
add filter for FATAL,ERROR,WARN,etc.
|
6
|
+
add log count per kind? (e.g. 20 errors, 5 warns, etc.)
|
7
|
+
|
8
|
+
css: use colors
|
9
|
+
|
10
|
+
- error/fatal - red?
|
11
|
+
- warn - // bold or organge?
|
12
|
+
- info - normal
|
13
|
+
- debug - light grey??
|
14
|
+
-->
|
15
|
+
|
16
|
+
<table>
|
17
|
+
<% Log.all.each do |log| %>
|
18
|
+
<tr>
|
19
|
+
<td class='log-id'><%= log.id %>.</td>
|
20
|
+
<td class='log-level <%= log.level %>'>[<%= log.level %>]</td>
|
21
|
+
<td class='log-msg <%= log.level %>'><%= log.msg %></td>
|
22
|
+
<td class='log-pid'><%= "#{log.pid}.#{log.tid}" %></td>
|
23
|
+
<td class='log-created-at' <%= log.level %>'><%= log.created_at %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
data/lib/logutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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: 2013-
|
12
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &84286280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *84286280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &84286030 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '3.3'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *84286030
|
36
36
|
description: Another Logger
|
37
37
|
email: opensport@googlegroups.com
|
38
38
|
executables: []
|
@@ -50,6 +50,11 @@ files:
|
|
50
50
|
- lib/logutils/db/models.rb
|
51
51
|
- lib/logutils/db/schema.rb
|
52
52
|
- lib/logutils/logger.rb
|
53
|
+
- lib/logutils/server.rb
|
54
|
+
- lib/logutils/server/public/style.css
|
55
|
+
- lib/logutils/server/views/_version.erb
|
56
|
+
- lib/logutils/server/views/index.erb
|
57
|
+
- lib/logutils/server/views/layout.erb
|
53
58
|
- lib/logutils/version.rb
|
54
59
|
- test/helper.rb
|
55
60
|
- test/test_logger.rb
|