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!
npm install logbucket
We're still searching for sponsors! Would you like to sponsor us?
- ⚖️ 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
ansis
for 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.
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."))
Create a Logbucket instance.
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)
Log messages to the console using a specified log type/category.
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.
Create a message template to create a custom log type/category.
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.
Create an error template to display the errors differently.
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.
Create a debug file instance to write all logs to.
Constructor Parameters:
path
(string
): The location of the de 8000 bug 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)
A collection of all available default colors:
white
,red
,orange
,yellow
,green
,blue
,gray
,cyan
,magenta
,purple
,pink
A collection of all available log types/categories:
info
,warning
,error
,system
,database
,debug
,plugin
,api
,client
,server
A utility type for hex-colors.
A parameter in the LogBucketInstance(type,message,params)
method.
All settings for the debug file metadata.
All contributions are welcome! Feel free to create a pull-request or issue in the Github repository.
💻 DJj123dj |
---|
Spread the beauty of clean logs — support our simple package by sharing it! 😁
v1.0.0 - README.md
© 2025 - DJdj Development - Discord - Terms - Privacy Policy - Support Us - License