📜  consoleLine - Javascript (1)

📅  最后修改于: 2023-12-03 15:00:01.685000             🧑  作者: Mango

consoleLine - JavaScript

Introduction

consoleLine is a JavaScript library that enhances the logging experience for programmers. It provides a simple and intuitive way to print styled and formatted messages to the console.

Features
  • Easily create visually appealing console output
  • Customize text color, background color, font styles, and more
  • Format log messages with variables and objects
  • Supports markdown formatting for rich output
  • Lightweight and easy to use
  • Compatible with web browsers and Node.js
Installation

To use consoleLine, you need to include the library in your JavaScript project. You can do this in one of the following ways:

Browser
<script src="console-line.js"></script>
Node.js

Install the library via npm:

npm install console-line

Then require it in your JavaScript file:

const consoleLine = require('console-line');
Usage

Once consoleLine is included in your project, you can start using its methods to create styled console output. Below are some examples of how to use the library:

Printing a basic log message
consoleLine.log('Hello, world!');
Applying custom styles
consoleLine.log('%cStyled Text', 'color: red; font-weight: bold; text-decoration: underline');
Formatting log messages with variables
const name = 'John';
const age = 25;
consoleLine.log(`Name: ${name}, Age: ${age}`, 'color: blue');
Printing an object
const user = { name: 'John', age: 25, email: 'john@example.com' };
consoleLine.log(user, 'background-color: #ddd');
Markdown formatting
consoleLine.log('**Bold** text', 'color: green');
consoleLine.log('*Italic* text', 'color: blue');
consoleLine.log('`Code` snippet', 'color: purple');
Conclusion

With consoleLine, you can easily create visually appealing and informative console output in your JavaScript projects. Its flexibility and simplicity make it an excellent choice for developers who want to enhance their logging experience. Happy coding!

Note: The consoleLine library is based on the console.log function and does not provide additional logging methods like console.error or console.warn.