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

exa-logger

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exa-logger - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

31

dist/index.js

@@ -6,19 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const dayjs_1 = __importDefault(require("dayjs"));
const chalk_1 = __importDefault(require("chalk"));
class Logger {
static info(...messages) {
this.log('INFO', ...messages);
}
static warn(...messages) {
this.log('WARN', ...messages);
}
static error(...messages) {
this.log('ERROR', ...messages);
}
}
exports.Logger = Logger;
Logger.log = (level, ...messages) => {
// Log with level, and timestamp, use chalk library to colorize the log.
const log = (level, ...messages) => {
const logData = [];

@@ -44,2 +30,17 @@ const date = (0, dayjs_1.default)().format('YYYY-MM-DD HH:mm:ss');

console.log(...logData);
// Return an object to allow chaining
return {
info: (...msgs) => log('INFO', ...msgs),
warn: (...msgs) => log('WARN', ...msgs),
error: (...msgs) => log('ERROR', ...msgs),
};
};
const info = (...messages) => log('INFO', ...messages);
const warn = (...messages) => log('WARN', ...messages);
const error = (...messages) => log('ERROR', ...messages);
exports.default = {
log,
info,
warn,
error,
};
{
"name": "exa-logger",
"version": "1.0.1",
"version": "1.0.2",
"description": "Advanced JavaScript logger for debugging.",

@@ -9,2 +9,3 @@ "main": "dist/index.js",

"build": "npx tsc",
"prepublishOnly": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -11,0 +12,0 @@ },

@@ -5,41 +5,44 @@ import dayjs from 'dayjs';

export class Logger {
static log = (level: LogLevel, ...messages: any) => {
// Log with level, and timestamp, use chalk library to colorize the log.
const logData = [];
const date = dayjs().format('YYYY-MM-DD HH:mm:ss');
const log = (level: LogLevel, ...messages: any) => {
const logData = [];
const date = dayjs().format('YYYY-MM-DD HH:mm:ss');
logData.push(`[${chalk.gray(date)}]`);
logData.push(`[${chalk.gray(date)}]`);
switch (level) {
case 'INFO':
logData.push(`${chalk.blue.bold(level)}`);
break;
case 'WARN':
logData.push(`${chalk.yellow.bold(level)}`);
break;
case 'ERROR':
logData.push(`${chalk.red.bold(level)}`);
break;
default:
logData.push(`${chalk.blue.bold(level)}`);
break;
}
switch (level) {
case 'INFO':
logData.push(`${chalk.blue.bold(level)}`);
break;
case 'WARN':
logData.push(`${chalk.yellow.bold(level)}`);
break;
case 'ERROR':
logData.push(`${chalk.red.bold(level)}`);
break;
default:
logData.push(`${chalk.blue.bold(level)}`);
break;
}
logData.push(":")
logData.push(...messages);
console.log(...logData);
logData.push(":")
logData.push(...messages);
console.log(...logData);
// Return an object to allow chaining
return {
info: (...msgs: any) => log('INFO', ...msgs),
warn: (...msgs: any) => log('WARN', ...msgs),
error: (...msgs: any) => log('ERROR', ...msgs),
};
};
static info(...messages: any) {
this.log('INFO', ...messages);
}
const info = (...messages: any) => log('INFO', ...messages);
const warn = (...messages: any) => log('WARN', ...messages);
const error = (...messages: any) => log('ERROR', ...messages);
static warn(...messages: any) {
this.log('WARN', ...messages);
}
static error(...messages: any) {
this.log('ERROR', ...messages);
}
}
export default {
log,
info,
warn,
error,
};
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