@ersanyamarya/common-node-utils
v0.1.4
Published
This library was generated with [Nx](https://nx.dev). It exports several utility modules:
Downloads
5
Readme
common-node-utils
This library was generated with Nx. It exports several utility modules:
logger-type
: Contains types or interfaces related to logging functionality. You can use thesetLogger
andsetLogLevel
functions to customize the logger and log level. The logger has methods for different log levels: debug, info, warn, error, fatal, and log.
Example usage:
import { logger, setLogger, setLogLevel } from 'common-node-utils/logger-type'
setLogLevel('debug')
logger.debug('This is a debug message')
random-token
: Contains a functionrandomTokenGenerate
for generating random tokens, often used for security purposes.
Example usage:
import { randomTokenGenerate } from 'common-node-utils/random-token'
const token = randomTokenGenerate(10)
console.log(token)
date-time
: Contains a functiondateAfter48Hours
that returns the date and time 48 hours from the current time.
Example usage:
import { dateAfter48Hours } from 'common-node-utils/date-time'
const futureDate = dateAfter48Hours()
console.log(futureDate)
console-colors
: Contains an objectcolors
that contains escape sequences for different console colors.colored-console
: Contains a custom loggercustomLogger
that logs messages in different colors based on the log level.
Example usage:
import { customLogger } from 'common-node-utils/colored-console'
customLogger.error('This is an error message')