
Research
5 Malicious Chrome Extensions Enable Session Hijacking in Enterprise HR and ERP Systems
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.
@kocal/logger
Advanced tools
The Node.js logger I have always dreamed of.
$ yarn add @kocal/logger
import { Logger } from '@kocal/logger';
// or
const { Logger } = require('@kocal/logger');
// Default logger
const logger = Logger.getLogger();
logger.debug('My message');
// Write `2019-01-15T12:30:10.000Z:: default :: debug :: My message`
logger.log('My message');
// Write `2019-01-15T12:30:10.000Z :: default :: log :: My message`
logger.info('My message');
// Write `2019-01-15T12:30:10.000Z :: info :: My message`
logger.warn('My message');
// Write `2019-01-15T12:30:10.000Z :: default :: warn :: My message`
logger.error('My message');
// Write `2019-01-15T12:30:10.000Z :: default :: error :: My message`
// Named logger
const namedLogger = Logger.getLogger('my-name');
namedLogger.debug('My message');
// Write `2019-01-15T12:30:10.000Z :: my-name :: debug :: My message`
Available levels are:
// at initialization
const logger = Logger.getLogger('my-logger', {
level: 'info',
});
// at runtime
logger.level = 'info';
// or
logger.setLevel('info');
// will display something
logger.error('Message');
logger.warn('Message');
logger.info('Message');
// won't display anything
logger.log('Message');
logger.debug('Message');
The default format is: Date.toISOString() :: loggerName :: levelColor(level) :: message.
You can override the format at any moment by calling logger.setFormat():
const logger = Logger.getLogger();
logger.format = (context, variables) => {
return `${context.date.toISOString()} :: ${context.message}`
}
// or
logger.setFormat((context, variables) => {
return `${context.date.toISOString()} :: ${context.message}`
})
logger.log('My message');
// Write `2019-01-15T12:30:10.000Z :: My message`
In version 2.0, Luxon dependency has been removed because its weight is about ~85kB, and ~77% of the size of the logger is due to Luxon.
To format the date, you can use date-fns format method:
import { Logger } from '@kocal/logger';
import { format as formatDate } from 'date-fns';
const logger = Logger.getLogger();
logger.format = (context, variables) => {
return `${formatDate(context.date, 'YYYY-MM-DD HH:mm:ss')} :: ${context.message}`;
}
logger.log('My message');
// Write `2019-01-15 13:13:10 :: My message`
You can specify static or dynamic variables like that:
const logger = Logger.getLogger();
logger.format = (context, variables) => {
return `${context.date} :: ${context.message} :: vars = ${JSON.stringify(variables)}`;
}
// pass a plain object
logger.variables = { count: 9000, foo: 'bar' }
// or a function that will be called at each time you log something
let anotherVariable = 'bar';
logger.variables = () => ({ count: 9000, foo: anotherVariable });
// or
logger.setVariables({ count: 9000, foo: 'bar' })
logger.setVariables(() => ({ count: 9000, foo: anotherVariable }))
logger.log('My message');
// Write `2019-01-15T12:30:10.000Z :: My message :: vars = {"count":9000,"foo":"bar"}`
All logs methods have a 2nd parameters where you can pass additional variables:
// pass a plain object
logger.log('My message', { count: 1234 });
// Write `2019-01-15T12:30:10.000Z :: My message :: vars = {"count":1234,"foo":"bar"}`
// or a function
logger.log('My message', () => ({ count: 1234 }));
// Write `2019-01-15T12:30:10.000Z :: My message :: vars = {"count":1234,"foo":"bar"}`
.getLogger( name = 'default', options = {}): LoggerReturns a singleton.
Parameters:
name: A name, 'default' by defaultoptions:
options.format: check .setFormatoptions.variables check setVariables.setFormat( (context, variables) => '...' ): voidCustomize log messages format.
Parameters:
context:
context.name: logger's name, 'default' by defaultcontext.level: 'debug', 'log', 'info', 'warn', or 'error'context.levelColor: the color that represents levelcontext.message: your messagecontext.chalk: an instance of chalkcontext.date: an instance of Datevariables: a fusion of variables defined with .setVariables and additional variables from logging methods.debug( message, additionalVariables = {} | Function ): void.log( message, additionalVariables = {} | Function ): void.info( message, additionalVariables = {} | Function ): void.warn( message, additionalVariables = {} | Function ): void.error( message, additionalVariables = {} | Function ): voidLog a message.
Parameters:
message: your message 🤷🏻additionalVariables: variables that will be merged with logger's variables.FAQs
The Node.js logger I have always dreamed of
The npm package @kocal/logger receives a total of 6 weekly downloads. As such, @kocal/logger popularity was classified as not popular.
We found that @kocal/logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.