xlog 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -58
- data/lib/xlog/version.rb +1 -1
- data/lib/xlog.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e093d33c6d4650e69e6319057c9f3c6d0657821c94fa339ec1fea3c0ba40dac
|
4
|
+
data.tar.gz: 82bb2b2910223c9af42cf19a159673b7e46daa94c448f5c3c43457f8489a7e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd086b221db39453401dd0bb5d1064cea47a6f747a3aa508f2a2060c497ffa3aefbb09b058491a2009f02bc1e86b0ff3998801c38306ce8be699009da9f272c6
|
7
|
+
data.tar.gz: 3af328da784bc4f1f7c7278d4e4e07bc13e2c6094134476569f38cbe30e5ed497dbaa45f34fa2ea0fbc80d6b074823d198b9dbaad3c106dac3d537c466307d10
|
data/README.md
CHANGED
@@ -1,58 +1,8 @@
|
|
1
|
-
# Xlog
|
1
|
+
# Xlog
|
2
2
|
|
3
|
-
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xlog`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
|
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
|
-
## Configuration
|
39
|
-
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.
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
Xlog.configure do |config|
|
43
|
-
config.custom_logger = Logger.new(STDOUT) # or Logger.new('foo.log', 10, 1024000) or any other
|
44
|
-
end
|
45
|
-
```
|
46
|
-
It's possible to set third-party logger like Logentries(r7rapid)
|
47
|
-
```ruby
|
48
|
-
require 'le'
|
49
|
-
|
50
|
-
Xlog.configure do |config|
|
51
|
-
config.custom_logger = Le.new(logentries_key, 'eu', tag: true)
|
52
|
-
end
|
53
|
-
```
|
54
|
-
|
55
|
-
Look [here](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) to know more about `Logger` configuration.
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
56
6
|
|
57
7
|
## Installation
|
58
8
|
|
@@ -70,6 +20,10 @@ Or install it yourself as:
|
|
70
20
|
|
71
21
|
$ gem install xlog
|
72
22
|
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
73
27
|
## Development
|
74
28
|
|
75
29
|
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.
|
@@ -78,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
78
32
|
|
79
33
|
## Contributing
|
80
34
|
|
81
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/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.
|
82
36
|
|
83
37
|
## License
|
84
38
|
|
@@ -86,7 +40,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
86
40
|
|
87
41
|
## Code of Conduct
|
88
42
|
|
89
|
-
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/
|
90
|
-
|
91
|
-
## Idea
|
92
|
-
Initially designed and created by [Orest Falchuk (OrestF)](https://github.com/OrestF)
|
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/[USERNAME]/xlog/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/xlog/version.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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OrestF
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|