ougai 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 +16 -1
- data/lib/ougai.rb +2 -2
- data/lib/ougai/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908df02d45d84049df967249b72ad554ad0859ee
|
4
|
+
data.tar.gz: 3b99828ad56c2d6ca951e6098704793c55440188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6eb4308b0825f963103e3247f8d1a4fb6bfe74f2b0b78451a73b1c62ab2950857571c8e5c108c067242925ed2209a130e807dde9c61e1427ebb882615507a50
|
7
|
+
data.tar.gz: 36df6974f50e6c4d1100c20a09f34810335703bce814941f3f9643869ea4c1937c82690ef4c55f9906ece2575ee1f1d38f4eeab700479da90c016a5a9db08326
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@ Ougai
|
|
2
2
|
=====
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/tilfin/ougai.svg?branch=master)](https://travis-ci.org/tilfin/ougai)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/ougai.svg)](https://badge.fury.io/rb/ougai)
|
5
6
|
|
6
7
|
A JSON logger is compatible with [bunyan](https://github.com/trentm/node-bunyan) for Node.js
|
7
8
|
|
@@ -36,7 +37,7 @@ require 'ougai'
|
|
36
37
|
logger = Ougai::Logger.new(STDOUT)
|
37
38
|
```
|
38
39
|
|
39
|
-
### log only message
|
40
|
+
### log only a message
|
40
41
|
|
41
42
|
```ruby
|
42
43
|
logger.info('Information!')
|
@@ -46,6 +47,20 @@ logger.info('Information!')
|
|
46
47
|
{"name":"main","hostname":"mint","pid":14607,"level":30,"time":"2016-10-16T22:26:48.835+09:00","v":0,"msg":"Information!"}
|
47
48
|
```
|
48
49
|
|
50
|
+
### log only an exception
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
begin
|
54
|
+
raise StandardError, 'some error'
|
55
|
+
rescue => ex
|
56
|
+
logger.error(ex)
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
```json
|
61
|
+
{"name":"main","hostname":"mint","pid":4422,"level":50,"time":"2016-10-22T13:05:02.989+09:00","v":0,"msg":"some error","err":{"name":"StandardError","message":"some error","stack":"main.rb:24:in `<main>'"}}
|
62
|
+
```
|
63
|
+
|
49
64
|
### log with a message and custom data
|
50
65
|
|
51
66
|
```ruby
|
data/lib/ougai.rb
CHANGED
@@ -47,8 +47,8 @@ module Ougai
|
|
47
47
|
def to_item(msg, ex, data)
|
48
48
|
item = {}
|
49
49
|
if ex.nil? && msg.is_a?(Exception)
|
50
|
-
item[:msg] =
|
51
|
-
item[:err] = serialize_ex(
|
50
|
+
item[:msg] = msg.to_s
|
51
|
+
item[:err] = serialize_ex(msg)
|
52
52
|
elsif ex
|
53
53
|
item[:msg] = msg
|
54
54
|
if ex.is_a?(Hash)
|
data/lib/ougai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ougai
|
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
|
- Toshimitsu Takahashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.2.2
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: JSON logger compatible node-bunyan.
|