fluent-logger
Advanced tools
Comparing version
@@ -16,3 +16,2 @@ 'use strict'; | ||
this.reconnectInterval = options.reconnectInterval || 600000; // Default is 10 minutes | ||
this.verbose = this.verbose || false; | ||
this._timeResolution = options.milliseconds ? 1 : 1000; | ||
@@ -87,3 +86,3 @@ this._socket = null; | ||
if (typeof time != "number") { | ||
time = (time ? time.getTime() : Date.now()) / this._timeResolution; | ||
time = Math.floor((time ? time.getTime() : Date.now()) / this._timeResolution); | ||
} | ||
@@ -90,0 +89,0 @@ |
{ | ||
"name": "fluent-logger", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -15,2 +15,13 @@ # fluent-logger for Node.js | ||
Simple configuration is following: | ||
<source> | ||
@type forward | ||
port 24224 | ||
</source> | ||
<match **.*> | ||
@type stdout | ||
</match> | ||
## Usage | ||
@@ -23,3 +34,3 @@ | ||
var logger = require('fluent-logger') | ||
// The 2nd argument can be omitted. Here is a defualt value for options. | ||
// The 2nd argument can be omitted. Here is a default value for options. | ||
logger.configure('tag', { | ||
@@ -47,3 +58,5 @@ host: 'localhost', | ||
.emit([label string], <record object>, [timestamp number/date], [callback function]) | ||
```js | ||
.emit([label string], <record object>, [timestamp number/date], [callback function]) | ||
``` | ||
@@ -137,6 +150,2 @@ Where only the `record` argument is required. If the label is set it will be | ||
**verbose** | ||
If set `true`, verbose output. | ||
[1]: https://nodejs.org/api/net.html#net_socket_connect_path_connectlistener | ||
@@ -143,0 +152,0 @@ [2]: https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback |
@@ -67,7 +67,8 @@ var expect = require('chai').expect; | ||
var s = new sender.FluentSender('debug', {port: server.port}); | ||
var timestamp = new Date(); | ||
var timestamp = new Date(2222, 12, 04); | ||
var timestamp_seconds_since_epoch = Math.floor(timestamp.getTime() / 1000); | ||
s.emit("1st record", "1st data", timestamp, function() { | ||
finish(function(data) { | ||
expect(data[0].time).to.be.equal(timestamp.getTime() / 1000); | ||
expect(data[0].time).to.be.equal(timestamp_seconds_since_epoch); | ||
done(); | ||
@@ -82,3 +83,3 @@ }); | ||
var s = new sender.FluentSender('debug', {port: server.port}); | ||
var timestamp = new Date().getTime() / 1000; | ||
var timestamp = Math.floor(new Date().getTime() / 1000); | ||
@@ -240,3 +241,3 @@ s.emit("1st record", "1st data", timestamp, function() { | ||
data: { bar: 1 }, | ||
time: 1384434467.952 | ||
time: 1384434467 | ||
} | ||
@@ -243,0 +244,0 @@ } |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
39240
0.51%160
5.96%