Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fastkit/tiny-logger

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastkit/tiny-logger - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

36

dist/tiny-logger.cjs.js

@@ -5,2 +5,4 @@ 'use strict';

var helpers = require('@fastkit/helpers');
const TINY_LOGGER_LOG_TYPES = [

@@ -13,25 +15,12 @@ 'debug',

];
const PALETTE = {
reset: '\u001b[0m',
// black: '\u001b[30m',
red: '\u001b[31m',
green: '\u001b[32m',
yellow: '\u001b[33m',
// blue: '\u001b[34m',
magenta: '\u001b[35m',
cyan: '\u001b[36m',
// white: '\u001b[37m'
};
const COLOR_MAP = {
debug: PALETTE.magenta,
info: PALETTE.cyan,
warn: PALETTE.yellow,
error: PALETTE.red,
success: PALETTE.green,
debug: 'magenta',
info: 'cyan',
warn: 'yellow',
error: 'red',
success: 'green',
};
let colorEnable = true;
class TinyLogger {
constructor(loggerName) {
this._name = loggerName;
}
_name;
static colorEnable(enable) {

@@ -43,7 +32,10 @@ colorEnable = enable;

}
constructor(loggerName) {
this._name = loggerName;
}
log(type, message, ...args) {
const colorOpenTag = (colorEnable && COLOR_MAP[type]) || '';
const colorCloseTag = colorOpenTag ? PALETTE.reset : '';
const color = colorEnable && COLOR_MAP[type];
const body = color ? helpers.consoleColorString(message, color) : message;
const fn = type === 'success' ? 'log' : type;
console[fn](`${colorOpenTag}[${this.name}] ${message}${colorCloseTag}`, ...args);
console[fn](body, ...args);
}

@@ -50,0 +42,0 @@ }

@@ -5,2 +5,4 @@ 'use strict';

var helpers = require('@fastkit/helpers');
const TINY_LOGGER_LOG_TYPES = [

@@ -13,25 +15,12 @@ 'debug',

];
const PALETTE = {
reset: '\u001b[0m',
// black: '\u001b[30m',
red: '\u001b[31m',
green: '\u001b[32m',
yellow: '\u001b[33m',
// blue: '\u001b[34m',
magenta: '\u001b[35m',
cyan: '\u001b[36m',
// white: '\u001b[37m'
};
const COLOR_MAP = {
debug: PALETTE.magenta,
info: PALETTE.cyan,
warn: PALETTE.yellow,
error: PALETTE.red,
success: PALETTE.green,
debug: 'magenta',
info: 'cyan',
warn: 'yellow',
error: 'red',
success: 'green',
};
let colorEnable = true;
class TinyLogger {
constructor(loggerName) {
this._name = loggerName;
}
_name;
static colorEnable(enable) {

@@ -43,7 +32,10 @@ colorEnable = enable;

}
constructor(loggerName) {
this._name = loggerName;
}
log(type, message, ...args) {
const colorOpenTag = (colorEnable && COLOR_MAP[type]) || '';
const colorCloseTag = colorOpenTag ? PALETTE.reset : '';
const color = colorEnable && COLOR_MAP[type];
const body = color ? helpers.consoleColorString(message, color) : message;
const fn = type === 'success' ? 'log' : type;
console[fn](`${colorOpenTag}[${this.name}] ${message}${colorCloseTag}`, ...args);
console[fn](body, ...args);
}

@@ -50,0 +42,0 @@ }

/// <reference types="node" />
import { ConsoleColorPaletteName } from '@fastkit/helpers';
export declare const COLOR_MAP: {
[K in TinyLoggerLogType]?: string;
[K in TinyLoggerLogType]?: ConsoleColorPaletteName;
};

@@ -6,0 +8,0 @@

@@ -0,1 +1,3 @@

import { consoleColorString } from '@fastkit/helpers';
const TINY_LOGGER_LOG_TYPES = [

@@ -8,25 +10,12 @@ 'debug',

];
const PALETTE = {
reset: '\u001b[0m',
// black: '\u001b[30m',
red: '\u001b[31m',
green: '\u001b[32m',
yellow: '\u001b[33m',
// blue: '\u001b[34m',
magenta: '\u001b[35m',
cyan: '\u001b[36m',
// white: '\u001b[37m'
};
const COLOR_MAP = {
debug: PALETTE.magenta,
info: PALETTE.cyan,
warn: PALETTE.yellow,
error: PALETTE.red,
success: PALETTE.green,
debug: 'magenta',
info: 'cyan',
warn: 'yellow',
error: 'red',
success: 'green',
};
let colorEnable = true;
class TinyLogger {
constructor(loggerName) {
this._name = loggerName;
}
_name;
static colorEnable(enable) {

@@ -38,7 +27,10 @@ colorEnable = enable;

}
constructor(loggerName) {
this._name = loggerName;
}
log(type, message, ...args) {
const colorOpenTag = (colorEnable && COLOR_MAP[type]) || '';
const colorCloseTag = colorOpenTag ? PALETTE.reset : '';
const color = colorEnable && COLOR_MAP[type];
const body = color ? consoleColorString(message, color) : message;
const fn = type === 'success' ? 'log' : type;
console[fn](`${colorOpenTag}[${this.name}] ${message}${colorCloseTag}`, ...args);
console[fn](body, ...args);
}

@@ -45,0 +37,0 @@ }

{
"name": "@fastkit/tiny-logger",
"version": "0.1.15",
"version": "0.1.16",
"description": "@fastkit/tiny-logger",

@@ -27,3 +27,6 @@ "buildOptions": {

},
"homepage": "https://github.com/dadajam4/fastkit/tree/dev/packages/tiny-logger#readme"
"homepage": "https://github.com/dadajam4/fastkit/tree/dev/packages/tiny-logger#readme",
"dependencies": {
"@fastkit/helpers": "0.1.16"
}
}
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