🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@tryghost/pretty-stream

Package Overview
Dependencies
Maintainers
28
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tryghost/pretty-stream - npm Package Compare versions

Comparing version

to
0.2.0

24

lib/PrettyStream.js

@@ -104,14 +104,20 @@ const dateFormat = require('date-format');

// Convert the time to UTC
const now = new Date();
const dataTime = new Date(data.time || now);
// Handle time formatting
let time;
// If the timezone offset is equal to the current timezone offset, and that timezone offset is not 0,
// then we need to adjust the time
if (dataTime.getTimezoneOffset() === now.getTimezoneOffset() && dataTime.getTimezoneOffset() !== 0) {
dataTime.setMinutes(dataTime.getMinutes() + dataTime.getTimezoneOffset());
if (data.time) {
// If time is provided as a string in the expected format, use it directly
if (typeof data.time === 'string' && /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(data.time)) {
time = data.time;
} else {
// Otherwise, parse and format it
const dataTime = new Date(data.time);
time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', dataTime);
}
} else {
// No time provided, use current time
const now = new Date();
time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', now);
}
const time = dateFormat.asString('yyyy-MM-dd hh:mm:ss', dataTime);
let logLevel = _private.levelFromName[data.level].toUpperCase();

@@ -118,0 +124,0 @@ const codes = _private.colors[_private.colorForLevel[data.level]];

{
"name": "@tryghost/pretty-stream",
"version": "0.1.29",
"repository": "https://github.com/TryGhost/framework/tree/main/packages/pretty-stream",
"version": "0.2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/TryGhost/framework.git",
"directory": "packages/pretty-stream"
},
"author": "Ghost Foundation",

@@ -32,3 +36,3 @@ "license": "MIT",

},
"gitHead": "783b40c3ece6e1c9e293d09f2c069baa3e1110b2"
"gitHead": "e395f1d79edee4aecc36e572bb402016a8ba9273"
}