jcapote-atomlog 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +34 -26
- data/VERSION.yml +2 -2
- metadata +32 -3
data/README.markdown
CHANGED
@@ -2,50 +2,58 @@
|
|
2
2
|
|
3
3
|
AtomLog is a library for converting ruby's Logger format into an Atom feed
|
4
4
|
|
5
|
-
##
|
5
|
+
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Add the github gem source if you haven't already:
|
8
|
+
|
9
|
+
gem sources -a http://gems.github.com
|
10
|
+
|
11
|
+
Install the gem:
|
8
12
|
|
9
|
-
|
13
|
+
gem install jcapote-atomlog
|
10
14
|
|
11
|
-
|
15
|
+
## Usage
|
12
16
|
|
13
|
-
|
17
|
+
### From within your applications:
|
14
18
|
|
15
|
-
|
16
|
-
gem install uuid
|
17
|
-
gem install file-tail
|
18
|
-
git clone git@github.com:jcapote/atomlog.git
|
19
|
+
Basic usage:
|
19
20
|
|
20
|
-
|
21
|
+
require 'atom_log'
|
22
|
+
a = AtomLog::Generator.new('path/to/log.log')
|
23
|
+
a.to_atom #=> feed as a string
|
24
|
+
|
25
|
+
For large or rapidly growing log files, it's useful only to see the last 10 or so events; To achieve this, just pass how many lines back you want to go to the generator constructor as the 2nd argument:
|
21
26
|
|
22
|
-
|
27
|
+
require 'atom_log'
|
28
|
+
a = AtomLog::Generator.new('path/to/log.log', 100)
|
29
|
+
a.to_atom #=> feed as a string
|
23
30
|
|
24
|
-
|
31
|
+
Or if you want to parse the log file into your own format (sql, json, etc), you can use the parser directly (this also takes the lines desired as the 2nd argument):
|
25
32
|
|
26
|
-
|
27
|
-
|
33
|
+
require 'atom_log'
|
34
|
+
a = AtomLog::Parser.new('path/to/log.log', 100)
|
35
|
+
a.parse #=> array of log fields
|
28
36
|
|
29
|
-
|
30
|
-
a = AtomLog::Generator.new('path/to/log.log')
|
31
|
-
a.to_atom
|
37
|
+
### From the shell:
|
32
38
|
|
33
|
-
|
39
|
+
It comes with a standalone tool, log2atom; use as such:
|
34
40
|
|
35
|
-
|
36
|
-
a = AtomLog::Generator.new('path/to/log.log', 100)
|
37
|
-
a.to_atom
|
41
|
+
log2atom logger-file.log
|
38
42
|
|
39
43
|
|
40
44
|
## Performance
|
41
45
|
|
42
46
|
Out of curiousity, I decided to benchmark reading a 4.4mb log file against all the ruby implementations on my machine, here are the results:
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
|
49
|
+
30s: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.2.0]
|
50
|
+
|
51
|
+
34s: jruby --server 1.1.6RC1 (ruby 1.8.6 patchlevel 114) (2008-12-03 rev 8263) [i386-java]
|
52
|
+
|
53
|
+
46s: jruby 1.1.6RC1 (ruby 1.8.6 patchlevel 114) (2008-12-03 rev 8263) [i386-java]
|
54
|
+
|
55
|
+
53s: ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
|
56
|
+
|
49
57
|
|
50
58
|
## License and Author
|
51
59
|
|
data/VERSION.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jcapote-atomlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jcapote
|
@@ -11,8 +11,37 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2009-02-26 00:00:00 -08:00
|
13
13
|
default_executable: log2atom
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: uuid
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: builder
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: file-tail
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
16
45
|
description: A library for parsing ruby's Logger format into an Atom feed
|
17
46
|
email: jcapote@gmail.com
|
18
47
|
executables:
|