New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gracelog

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gracelog - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

24

CHANGELOG.md
# Change log
## Version 0.3.0
## Added
#### Added useTimestamp to configuration object
By given `useTimestamp`(Boolean) in the configuration object, the logger users Unix timestamp instead of the server local time.
**NOTE**: File rotation still uses server local time for file names.
## Changed
None
## Deprecated
None
## Removed
None
***
## Version 0.2.3

@@ -4,0 +28,0 @@

15

lib/msg.js

@@ -6,2 +6,3 @@ var util = require('util');

var depth = 4;
var useTimestamp = false;

@@ -16,9 +17,17 @@ module.exports.setup = function (config) {

}
if (config.useTimestamp) {
useTimestamp = config.useTimestamp;
}
};
module.exports.create = function (prefix, logName, levelName, args) {
var timestamp;
var date = new Date();
var ymd = date.getFullYear() + '/' + pad(date.getMonth() + 1, 2) + '/' + pad(date.getDate(), 2);
var his = pad(date.getHours(), 2) + ':' + pad(date.getMinutes(), 2) + ':' + pad(date.getSeconds(), 2) + ':' + pad(date.getMilliseconds(), 3);
var timestamp = ymd + ' ' + his;
if (useTimestamp) {
timestamp = date.getTime();
} else {
var ymd = date.getFullYear() + '/' + pad(date.getMonth() + 1, 2) + '/' + pad(date.getDate(), 2);
var his = pad(date.getHours(), 2) + ':' + pad(date.getMinutes(), 2) + ':' + pad(date.getSeconds(), 2) + ':' + pad(date.getMilliseconds(), 3);
timestamp = ymd + ' ' + his;
}
var msg = ['[' + timestamp + ']' + (prefix ? '[' + prefix + ']' : '') + '<' + levelName + '>[' + logName + ']'];

@@ -25,0 +34,0 @@ for (var key in args) {

2

package.json
{
"name": "gracelog",
"description": "Log management module",
"version": "0.2.4",
"version": "0.3.0",
"author": "Nobuyori Takahashi <voltrue2@yahoo.com>",

@@ -6,0 +6,0 @@ "repository": {

@@ -1,4 +0,4 @@

#gracelog
# gracelog
###Access
### Access
```javascript

@@ -9,8 +9,9 @@ var gracelog = require('gracelog');

###Configurations
### Configurations
###.config(configData [object])
### .config(configData [object])
```
var configData = {
"useTimestamp": <bool> // if given true, the logging time will be in Unix timestamp instead of the server time
"bufferSize": <int> // log data buffer size in memory (bytes),

@@ -17,0 +18,0 @@ "bufferFlushInterval": <int> // log data buffer auto flush interval in milliseconds,

@@ -12,3 +12,4 @@ var assert = require('assert');

color: true,
file: false
file: false,
useTimestamp: true
});

@@ -15,0 +16,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc