xlog 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +69 -9
- data/lib/xlog/version.rb +1 -1
- data/lib/xlog/xlogger.rb +4 -0
- data/lib/xlog.rb +4 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ccd2436fed84277e65b847759e35046266a1863b4056fadfc01b85e751d3c2c
|
4
|
+
data.tar.gz: d386c7834e49faaffbcf23e0e1d32fdb7312583b6268cac18fd5028bbf286591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe55daec4b7ff8b3f33b05a59568d2c23bf2ccb52f142d2d2376965fe5821c3a6ea629a55f6e3f0cb5e15f0abf9220b4b7b9f954a3e387e74e00b97587b4b7c9
|
7
|
+
data.tar.gz: e80b2ff448b6da4446d8252236059b2bd36aed7fd5547086466a9f1d534e627b57253c455b9ab0282ada4ef8df95d6579d322c11be144de15b114fc0882ce8a5
|
data/README.md
CHANGED
@@ -1,8 +1,69 @@
|
|
1
|
-
# Xlog
|
1
|
+
# Xlog v0.0.1
|
2
2
|
|
3
|
-
|
3
|
+
Xlog - awesome logger for your Rails app. Logs everything you need in well-formatted view with timestamp, caller path and tags.
|
4
4
|
|
5
|
-
|
5
|
+
## Usage
|
6
|
+
Log any info with `.info` method
|
7
|
+
```ruby
|
8
|
+
Xlog.info('Some info text') # [2019-04-30 12:29:13 UTC] [ArtilesController.show] [info] Message: Some info text
|
9
|
+
```
|
10
|
+
Log important info with `.warn` method
|
11
|
+
```ruby
|
12
|
+
Xlog.warn('Validation failed') # [2019-04-30 12:29:13 UTC] [ArticlesController.update] [warn] Message: Validation failed
|
13
|
+
```
|
14
|
+
|
15
|
+
Xlog has awesome `.error` and `.and_raise_error` methods
|
16
|
+
```ruby
|
17
|
+
def index
|
18
|
+
10 / 0
|
19
|
+
@orders = Order.all
|
20
|
+
rescue StandardError => e
|
21
|
+
Xlog.and_raise_error(e, data: { params: params }, message: 'Some message text here')
|
22
|
+
end
|
23
|
+
```
|
24
|
+
...and the output
|
25
|
+
```
|
26
|
+
[2019-04-30 11:48:33 UTC] [Admin::OrdersController.index] [error] ZeroDivisionError: divided by 0.
|
27
|
+
| Message: Some message text here
|
28
|
+
| Data: {:params=><ActionController::Parameters {"controller"=>"admin/orders", "action"=>"index"} permitted: false>}
|
29
|
+
| Error backtrace:
|
30
|
+
| /home/me/test_app/app/controllers/admin/orders_controller.rb:7:in `/'
|
31
|
+
| /home/me/test_app/app/controllers/admin/orders_controller.rb:7:in `index'
|
32
|
+
```
|
33
|
+
The only difference between `Xlog.error` and `Xlog.and_raise_error` is that second one raises error after logging.
|
34
|
+
|
35
|
+
Xlog automatically defines Rails application name and environment.
|
36
|
+
It writes logs into `log/xlog_[environement].log`
|
37
|
+
|
38
|
+
Xlog also supports custom tags
|
39
|
+
```ruby
|
40
|
+
Xlog.tag_logger('custom_tag')
|
41
|
+
Xlog.info('Some text') # [2019-04-30 12:29:13 UTC] [ArtilesController.show] [info] [custom_tag] Message: Some info text
|
42
|
+
```
|
43
|
+
|
44
|
+
Clear tags with:
|
45
|
+
```ruby
|
46
|
+
Xlog.clear_tags
|
47
|
+
```
|
48
|
+
|
49
|
+
## Configuration
|
50
|
+
Xlog is ready to use right out of the box, but it's possible to reconfigure default logger. Default logger is simple `Logger.new`. Add this code to `config/initializers/xlog.rb` and set any custom logger you want.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
Xlog.configure do |config|
|
54
|
+
config.custom_logger = Logger.new(STDOUT) # or Logger.new('foo.log', 10, 1024000) or any other
|
55
|
+
end
|
56
|
+
```
|
57
|
+
It's possible to set third-party logger like Logentries(r7rapid)
|
58
|
+
```ruby
|
59
|
+
require 'le'
|
60
|
+
|
61
|
+
Xlog.configure do |config|
|
62
|
+
config.custom_logger = Le.new(logentries_key, 'eu', tag: true)
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
Look [here](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) to know more about `Logger` configuration.
|
6
67
|
|
7
68
|
## Installation
|
8
69
|
|
@@ -20,10 +81,6 @@ Or install it yourself as:
|
|
20
81
|
|
21
82
|
$ gem install xlog
|
22
83
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
84
|
## Development
|
28
85
|
|
29
86
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -32,7 +89,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
89
|
|
33
90
|
## Contributing
|
34
91
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
92
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/coaxsoft/xlog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
93
|
|
37
94
|
## License
|
38
95
|
|
@@ -40,4 +97,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
97
|
|
41
98
|
## Code of Conduct
|
42
99
|
|
43
|
-
Everyone interacting in the Xlog project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
100
|
+
Everyone interacting in the Xlog project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/coaxsoft/xlog/blob/master/CODE_OF_CONDUCT.md).
|
101
|
+
|
102
|
+
## Idea
|
103
|
+
Initially designed and created by [Orest Falchuk (OrestF)](https://github.com/OrestF)
|
data/lib/xlog/version.rb
CHANGED
data/lib/xlog/xlogger.rb
CHANGED
data/lib/xlog.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OrestF
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Xlog
|
69
|
+
description: Xlog - awesome logger for your Rails app. Logs everything you need in
|
70
|
+
well-formatted view with timestamp, caller path and tags.
|
70
71
|
email:
|
71
72
|
- falchuko@gmail.com
|
72
73
|
executables: []
|
@@ -77,7 +78,7 @@ files:
|
|
77
78
|
- lib/xlog.rb
|
78
79
|
- lib/xlog/version.rb
|
79
80
|
- lib/xlog/xlogger.rb
|
80
|
-
homepage: https://github.com/
|
81
|
+
homepage: https://github.com/coaxsoft/xlog
|
81
82
|
licenses:
|
82
83
|
- MIT
|
83
84
|
metadata: {}
|
@@ -99,5 +100,6 @@ requirements: []
|
|
99
100
|
rubygems_version: 3.0.1
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
|
-
summary: Xlog
|
103
|
+
summary: Xlog - awesome logger for your Rails app. Logs everything you need in well-formatted
|
104
|
+
view with timestamp, caller path and tags.
|
103
105
|
test_files: []
|