Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
log-beautify
Advanced tools
Readme
Show log messages on your terminal with style :-) . Use debugging levels to enable or disable log messages.
npm install log-beautify
const log = require('log-beautify');
log.trace('Trace');//change the level to use trace
log.success('Success');
log.ok('Ok');//success alias
log.debug('Debug');
log.info('Info');
log.warning('Warning');
log.warn('Warn');//warning alias
log.error('Error');
log.success()
(for text color)log.success_()
(for background color)log.ok()
(log.success() alias)log.ok_()
(log.success_() alias)log.debug()
log.debug_()
log.info()
log.info_()
log.warning()
log.warning_()
log.warn()
(log.warning() alias)log.warn_()
(log.warning_() alias)log.error()
log.error_()
log.show()
(default console.log())You can create your own log methods, for example:
log.setColors({
custom_: "green",
});
log.setSymbols({
custom_: "✅ ",
});
//Now you can use it
log.custom_('Server listening on port 3000 ');
Global level is: 1
Default level for new log methods: 1
Default levels:
{
silent: -1,//hide all logs
trace: 0,
success: 1,
debug: 2,
info: 3,
warning: 4,
error: 5,
}
log.useSymbols = true
(Enable or disable symbols)log.useLabels = true
(Enable or disable labels)log.setColors({})
(Add or change colors)log.setSymbols({})
(Add or change symbols)log.setLabels({})
(Add or change labels)log.setTextColors({})
(Change text colors for bg logs)log.setLevel(1)
(Change global level, default = 1)log.setLevel(1, 'namespace')
(log.setNamespaceLevel() alias)log.setNamespaceLevel(1, 'namespace')
(Create level with namespace and use it in current file, The global level will be ignored)log.namespace('namespace')
(log.useNamespace() alias)log.useNamespace('namespace')
(Use the level of a namespace in the current file, The global level will be ignored. You can use namespaces created in other files)log.setLocalLevel(1)
(Create a level to use only in the current file, The global level will be ignored)log.setLevels({})
(Add or change levels)You can use the following color formats. (Use strings)
keyword
Example: "red"
(black,white,red,green,yellow,magenta,cyan,gray)hex
Example: "#FFF000"
rgb
Example: "rgb(255, 255, 255)"
hsl
Example: "hsl(0, 100%, 50%)"
hsv
Example: "hsv(330, 93%, 98%)"
hwb
Example: "hwb(0, 100%, 0%)"
/**
|--------------------------------------------------
| Disable symbols
|--------------------------------------------------
*/
log.useSymbols = false;
/**
|--------------------------------------------------
| Disable labels
|--------------------------------------------------
*/
log.useLabels = false;
/**
|--------------------------------------------------
| Change colors
|--------------------------------------------------
*/
log.setColors({
success: "#00FF00",
error_: "rgb(191,0,96)",
info_: "cyan",
});
/**
|--------------------------------------------------
| Add or change new log methods
|--------------------------------------------------
*/
//When you add a color, the method will automatically be created.
log.setColors({
danger: "#FF8000",
danger_: "hsl(310, 99%, 57%)",
saved: 'green',
});
//Now you can use log.danger() and log.danger_() and log.saved()
/**
|--------------------------------------------------
| Add or change symbols
|--------------------------------------------------
*/
log.setSymbols({
danger: "⛔ ",
ok: "👍 ",
saved: "✅ "
});
/**
|--------------------------------------------------
| Add or change labels
|--------------------------------------------------
*/
log.setLabels({
warning: "WARNING!!!",
});
/**
|--------------------------------------------------
| Add or change text colors for bg logs
|--------------------------------------------------
*/
log.setTextColors({
error_: 'black',
info_: 'black',
});
/**
|--------------------------------------------------
| Add or change levels
|--------------------------------------------------
*/
log.setLevels({
fatal: 6,
custom: "info"//use info level
});
/**
|--------------------------------------------------
| Change global level. 2 = "debug"
|--------------------------------------------------
*/
log.setLevel(2);
//log.setLevel('debug');
/**
|--------------------------------------------------
| Add level "info = 3" to use only in the current file, The global level will be ignored
|--------------------------------------------------
*/
log.setLocalLevel('info');
/**
|--------------------------------------------------
| Create level with namespace and use it in current file, The global level will be ignored
|--------------------------------------------------
*/
log.setNamespaceLevel('error', 'show-only-errors');
/**
|--------------------------------------------------
| Use namespace created previously. You can use namespaces created in other files.
|--------------------------------------------------
*/
log.useNamespace('show-only-errors');
//log.namespace('show-only-errors');
MIT
FAQs
Show log messages on your terminal with style :-) . Use debugging levels to enable or disable log messages.
The npm package log-beautify receives a total of 636 weekly downloads. As such, log-beautify popularity was classified as not popular.
We found that log-beautify 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.