8000 GitHub - DJj123dj/logbucket: 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.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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.

License

Notifications You must be signed in to change notification settings

DJj123dj/logbucket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logbucket Logo

discord version license stars

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!

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 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.

📸 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

View full examples in Github Repository

function LogBucket(): LogBucketInstance

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)

function LogBucketInstance(): void

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.

class new LBMessageTemplate(): void

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.

class new LBErrorTemplate()

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.

class new LBDebugFile()

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)

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.

Profile Picture
💻 DJj123dj

⭐️ Star History

Spread the beauty of clean logs — support our simple package by sharing it! 😁

Star History Chart

Open Ticket Logo

v1.0.0 - README.md
© 2025 - DJdj Development - Discord - Terms - Privacy Policy - Support Us - License

About

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.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 
0