logbucket
v1.1.0
Published
A small package to create awesome and beautiful logs in the node.js console with colors, prefixes and the ability to be saved in a debug file.
Downloads
7
Maintainers
Readme
Logbucket
Logbucket is a lightweight and customizable logging library for Node.js featuring beautiful logs with configurable colors, prefixes and the ability to be saved to a debug file in real-time. If you're having trouble configuring the library, feel free to join our support server and we will help you further!
Installation using npm ⬇️
npm install logbucket❤️ Sponsors
We're still searching for sponsors! Would you like to sponsor us?
📌 Features
- ⚖️ Lightweight — Minimal footprint, maximum performance.
- 🚨 Built with TypeScript — Enjoy full type safety and intelligent autocompletion.
- ⭐️ Beautiful Logs — Quickly create clean, stylish, and readable logs.
- ⚙️ Highly Customizable — Fine-tune styles, templates and more.
- 📄 Custom Log Types — Define your own log categories and behaviors.
- 🎨 Full RGB Color Support — Powered by
ansisfor vibrant, customizable colors. - 📝 Real-Time Log Saving — Automatically save all logs to a debug file as they happen.
- 🎯 Event-Driven — Listen to events and define your own custom reactions.
- 🧽 Automatic Cleaning — Automatically clear logs in the debug file to make sure it won't exceed a certain limit.
📸 Examples
🛠️ Quick Usage
TIP: Detailed examples are available in the
./examples/directory in the Github repository.
const {LogBucket} = require("logbucket")
//import {LogBucket} from "logbucket"
//create a Logbucket instance
const log = LogBucket()
/////////////////////////
//// READY FOR USAGE ////
/////////////////////////
//try different log types
log("error","Hello world!")
log("warning","Hello world!")
log("info","Hello world!")
//try logging with parameters
log("debug","Hello world!",[
{key:"lorem",value:"ipsum"},
{key:"foo",value:"bar"}
])
//log an error to the console (e.g. from a try-catch)
log(new Error("This is an example error."))🧩 API Reference
function LogBucket(): LogBucketInstance
Parameters (Optional):
disableDefault?(boolean): Disable the built-in templates (to replace them with your own)templates?(object): An object containing additional/custom templates (LBMessageTemplate)errTemplate?(LBErrorTemplate): Add a custom template for logging JS errors (new Error(...))debugFile?(LBDebugFile): Add a debug file to write all logs to. (Disabled by default)
function LogBucketInstance(): void
Parameters (Message):
type(string): The type to use for this message. Must be a custom or default registered type.message(string): The message to log to the console.params?(LBMessageParam[]): Add custom parameters to the message.
- format:
{key:string, value:string, hidden:boolean}Parameters (Error):
error(Error): The error to log to the console.Listen for events:
- Use
LogBucketInstance.on(eventName,callback)to listen for events.
class new LBMessageTemplate(): void
Constructor Parameters:
prefix(string): The prefix to use (uppercase recommended)prefixColor(LBDefaultColor|LBHexColor): The color of the prefix.msgColor(LBDefaultColor|LBHexColor): The color of the message.paramsColor(LBDefaultColor|LBHexColor): The color of the parameters.
class new LBErrorTemplate()
Constructor Parameters:
titleColor(LBDefaultColor|LBHexColor): The color of the title.descriptionColor(LBDefaultColor|LBHexColor): The color of the description.title?(string): The title/prefix to use (uppercase recommended)description?(string): An optional description to display below the error for additional information or bug reporting.
class new LBDebugFile()
Constructor Parameters:
path(string): The location of the debug file relative to the current directory. (process.cwd())maxHistoryLength?(number): The maximum length of the debug file. It will start to scroll once the limit has been reached.metadata?(LBDebugFileMetadata): Customise the metadata of the debug file. (top of file)
type LBDefaultColor
A collection of all available default colors:white,red,orange,yellow,green,blue,gray,cyan,magenta,purple,pink
type LBDefaultType
A collection of all available log types/categories:info,warning,error,system,database,debug,plugin,api,client,server
type LBHexColor
A utility type for hex-colors.
interface LBMessageParam
A parameter in the LogBucketInstance(type,message,params) method.
interface LBDebugFileMetadata
All settings for the debug file metadata.
🛠️ Contributors
All contributions are welcome! Feel free to create a pull-request or issue in the Github repository.
⭐️ Star History
Spread the beauty of clean logs — support our simple package by sharing it! 😁
v1.1.0 - README.md © 2025 - DJdj Development - Discord - Terms - Privacy Policy - Support Us - License
