logwise v0.0.2
Fancy Logger
📜 Introduction
The Fancy Logger is a logging system based on Winston, designed to provide and record detailed and organized logs for Node.js applications. It includes support for global logging and specific functions for different types of events, without the need to export it in every file where it is used!
📦 Installation
npm install fancy-logger
🚀 Usage
import { log } from "fancy-logger";
log.api("Request made to API.");
log.db("Database connection request initiated.");
log.error("Failed to process request.", error);
log.error(error);
log.verbose([{ user: "admin", action: "login" }, some_method()]);
🔥 Features
📌 API Log
log.api("Message");
Description: Used to record events related to the API.
🛢️ Database Log
log.db("Database query");
Description: Records events and transactions occurring in the database.
⚠️ Error Log
log.error("Message to identify the error: ", errorObj); // With or without description!
log.error(error);
Description: Records error messages, accepting any type of data.
🛠️ Verbose Log
log.verbose(objectOrFunction);
Description: Used for advanced debugging, identifying variable types, methods, and listing all properties of the given object.
WARNING: As the name suggests, this method is extremely verbose and can produce extensive output. I recommend using log.debug
in most cases!
✅ Success Log
log.success("Operation completed successfully!");
Description: Used to register successful calls.
🛠️ Debug Log
log.debug(variable);
Description: Used for debugging without excessive verbosity. Unlike log.verbose
, this method provides enough information to analyze variables without generating an extensive log.
❗ Best Practices and Additional Information
- The
log.verbose
andlog.debug
methods are disabled in production environments for security reasons. Their logs are also never saved or persisted! - Do not expose sensitive logs in production.
- When debugging passwords, tokens, and other sensitive information, always use the debugger instead of storing this data in log files.
- Ensure error logs are recorded correctly for future analysis.
- Use
log.success
to register successful operations! - Give a star to this repository so your bugs get fixed. ✨
📜 License
The Fancy Logger is licensed under MIT.
🔗 Contact
Developed by Manolo Dias. Any suggestions? Do you think something is missing? Get in touch! For questions or suggestions:
- WhatsApp: +55 (21) 96889-9448
- GitHub: Manolo Dias
- Email: manolo@blenddev.com.br
- Team: GRUPO BLEND