logutils-activerecord 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.md +4 -0
- data/Manifest.txt +6 -0
- data/README.md +62 -0
- data/Rakefile +33 -0
- data/lib/logutils/activerecord.rb +4 -0
- data/lib/logutils/activerecord/version.rb +23 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 637f7d2a4d2688dd640b9b93a4be76e1c89cf078
|
4
|
+
data.tar.gz: 01a2e677deb140556a402337ca06913cb19d941a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fb563c7c27808faf717c7ca96d4f9979339840c22600d24f9fb0147ead123a70de4b049433719c3aff466c3afc3257c5a819e7dbb23b1b6a981e7565e13c5f7b
|
7
|
+
data.tar.gz: 600eb38f7a649ad2e147148921ecf89e0e3cc04bbd0c5b12b2de5b3da520981f946429d5d2c52b18eeb9470fecd9f07971a83c489a11c32f5b283edfd35761e1
|
data/History.md
ADDED
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# logutils-activerecord - Another Logger - Addon for Database Support (LogDb, Log Model etc.)
|
2
|
+
|
3
|
+
* home :: [github.com/rubylibs/logutils-activerecord](https://github.com/rubylibs/logutils-activerecord)
|
4
|
+
* bugs :: [github.com/rubylibs/logutils-activerecord/issues](https://github.com/rubylibs/logutils-activerecord)
|
5
|
+
* gem :: [rubygems.org/gems/logutils-activerecord](https://rubygems.org/gems/logutils-activerecord)
|
6
|
+
* rdoc :: [rubydoc.info/gems/logutils-activerecord](http://rubydoc.info/gems/logutils-activerecord)
|
7
|
+
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
### Log to the database using `LogDb`
|
12
|
+
|
13
|
+
NB: To use the `LogDb` machinery require the module, that is, issue:
|
14
|
+
|
15
|
+
require 'logutils/activerecord'
|
16
|
+
|
17
|
+
To create the database tables use:
|
18
|
+
|
19
|
+
LogDb.create
|
20
|
+
|
21
|
+
To start logging to the database (established connection required) use:
|
22
|
+
|
23
|
+
LogDb.setup
|
24
|
+
|
25
|
+
To clean out all log records from the database use:
|
26
|
+
|
27
|
+
LogDb.delete!
|
28
|
+
|
29
|
+
|
30
|
+
### All together now
|
31
|
+
|
32
|
+
require 'logutils'
|
33
|
+
require 'logutils/activerecord' # NOTE: will also require 'active_record'
|
34
|
+
|
35
|
+
include LogUtils # lets you use Logger instead of LogUtils::Logger
|
36
|
+
|
37
|
+
logger = Logger[ 'Test' ]
|
38
|
+
logger.info 'hello LogUtils'
|
39
|
+
|
40
|
+
LOG_DB_CONFIG = {
|
41
|
+
adapter: 'sqlite3',
|
42
|
+
database: './log.db'
|
43
|
+
}
|
44
|
+
|
45
|
+
pp LOG_DB_CONFIG
|
46
|
+
ActiveRecord::Base.establish_connection( LOG_DB_CONFIG )
|
47
|
+
|
48
|
+
LogDb.create
|
49
|
+
LogDb.setup
|
50
|
+
|
51
|
+
logger.info 'hola LogUtils'
|
52
|
+
logger.warn 'servus LogUtils'
|
53
|
+
|
54
|
+
|
55
|
+
That's it.
|
56
|
+
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The `logutils-activerecord` scripts are dedicated to the public domain.
|
61
|
+
Use it as you please with no restrictions whatsoever.
|
62
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/logutils/activerecord/version.rb'
|
3
|
+
|
4
|
+
|
5
|
+
Hoe.spec 'logutils-activerecord' do
|
6
|
+
|
7
|
+
self.version = LogDb::VERSION
|
8
|
+
|
9
|
+
self.summary = 'Another Logger - Addon for Database Support (LogDb, Log Model etc.)'
|
10
|
+
self.description = summary
|
11
|
+
|
12
|
+
self.urls = ['https://github.com/rubylibs/logutils-activerecord']
|
13
|
+
|
14
|
+
self.author = 'Gerald Bauer'
|
15
|
+
self.email = 'opensport@googlegroups.com'
|
16
|
+
|
17
|
+
# switch extension to .markdown for gihub formatting
|
18
|
+
# -- Note: auto-changed when included in manifest
|
19
|
+
self.readme_file = 'README.md'
|
20
|
+
self.history_file = 'History.md'
|
21
|
+
|
22
|
+
self.licenses = ['Public Domain']
|
23
|
+
|
24
|
+
self.extra_deps = [
|
25
|
+
['logutils', '>=0.6.1'],
|
26
|
+
['activerecord'], # Note: will include activesupport,etc.
|
27
|
+
]
|
28
|
+
|
29
|
+
self.spec_extras = {
|
30
|
+
required_ruby_version: '>= 1.9.2'
|
31
|
+
}
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module LogDb
|
4
|
+
|
5
|
+
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
6
|
+
MINOR = 0
|
7
|
+
PATCH = 1
|
8
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
|
+
|
10
|
+
def self.version
|
11
|
+
VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.banner
|
15
|
+
"logdb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.root
|
19
|
+
"#{File.expand_path( File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) )}"
|
20
|
+
end
|
21
|
+
|
22
|
+
end # module LogDb
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logutils-activerecord
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logutils
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.6.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.6.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hoe
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.13'
|
69
|
+
description: Another Logger - Addon for Database Support (LogDb, Log Model etc.)
|
70
|
+
email: opensport@googlegroups.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files:
|
74
|
+
- History.md
|
75
|
+
- Manifest.txt
|
76
|
+
- README.md
|
77
|
+
files:
|
78
|
+
- History.md
|
79
|
+
- Manifest.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/logutils/activerecord.rb
|
83
|
+
- lib/logutils/activerecord/version.rb
|
84
|
+
homepage: https://github.com/rubylibs/logutils-activerecord
|
85
|
+
licenses:
|
86
|
+
- Public Domain
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options:
|
90
|
+
- "--main"
|
91
|
+
- README.md
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.9.2
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Another Logger - Addon for Database Support (LogDb, Log Model etc.)
|
110
|
+
test_files: []
|