What is log-symbols?
The log-symbols package provides a set of symbols for use in console logging, which are especially useful for distinguishing different levels of log messages such as success, info, warning, and error. These symbols are cross-platform and will display correctly on different operating systems, including fallbacks for Windows.
What are log-symbols's main functionalities?
Success Symbol
Displays a green check mark to indicate a successful operation.
const logSymbols = require('log-symbols');
console.log(logSymbols.success, 'Operation successful!');
Info Symbol
Displays a blue 'i' to represent an informational message.
const logSymbols = require('log-symbols');
console.log(logSymbols.info, 'Information message.');
Warning Symbol
Displays a yellow exclamation mark to signal a warning.
const logSymbols = require('log-symbols');
console.log(logSymbols.warning, 'Warning! Something needs attention.');
Error Symbol
Displays a red cross to indicate an error or a problem.
const logSymbols = require('log-symbols');
console.log(logSymbols.error, 'Error! Something went wrong.');
Other packages similar to log-symbols
chalk
Chalk is a popular package that allows you to style and colorize text in the console. While it doesn't provide symbols, it is often used in conjunction with log-symbols to color the text accompanying the symbols for better visibility and emphasis.
figures
Figures provides a set of unicode symbols that can be used in the console, similar to log-symbols. It includes more symbols than log-symbols, offering a wider variety of icons for different use cases.
ora
Ora is a package that provides elegant terminal spinners. Although its primary feature is different, it includes symbols for success, info, warning, and error, which can be used similarly to log-symbols.
cli-spinners
cli-spinners is a collection of spinners for use in the terminal, similar to ora. It also includes some static symbols, but its main focus is on animated spinners for long-running tasks.
log-symbols
Colored symbols for various log levels
Includes fallbacks for Windows CMD which only supports a limited character set.
Install
$ npm install log-symbols
Usage
const logSymbols = require('log-symbols');
console.log(logSymbols.success, 'Finished successfully!');
API
logSymbols
info
success
warning
error
Related