Skip to content

Commit 9e1ca1a

Browse files
committed
Update README for nanosecond_precision
1 parent 5ed2107 commit 9e1ca1a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,20 @@ Fluent::Logger::ConsoleLogger.open(io)
126126
Fluent::Logger::NullLogger.open
127127
```
128128

129-
## Buffer overflow
129+
## Tips
130+
131+
### Use nanosecond-precision time
132+
133+
To send events with nanosecond-precision time (Fluent 0.14 and up), specify `nanosecond_precision` to `FluentLogger` constructor.
134+
135+
```rb
136+
log = Fluent::Logger::FluentLogger.new(nil, :host => 'localhost', :port => 24224, :nanosecond_precision => true)
137+
# Use nanosecond time instead
138+
log.post("myapp.access", {"agent" => "foo"})
139+
log.post_with_time("myapp.access", {"agent" => "foo"}, Time.now) # Need Time object for post_with_time
140+
```
141+
142+
### Buffer overflow
130143

131144
You can inject your own custom proc to handle buffer overflow in the event of connection failure. This will mitigate the loss of data instead of simply throwing data away.
132145

0 commit comments

Comments
 (0)