Giter VIP home page Giter VIP logo

debux's Introduction

Debux

Easy-to-use library for debugging your code

NOTE! This library is still in development and may not work as expected!

image

Support

You can contact us on our Discord server

Usage

calling debux() will always return the same instance on debux that was initialized within the same process!

const debux = require("debux");

const debug = debux();

debug.log("This is a log");

Different methods

debug.log("this is a log", {
    process: "process",
    class: "className",
    function: "function",
    event: "event"
});

debug.error("this is an error", {
    process: "process",
    class: "className",
    function: "function",
    event: "event"
});

debug.warn("this is a warning", {
    process: "process",
    class: "className",
    function: "function",
    event: "event"
});

debug.info("this is info", {
    process: "process",
    class: "className",
    function: "function",
    event: "event"
});

debug.logs() // will log all logs in the cache
/*
[
  'Tue, 06 Jul 2021 13:18:24 GMT | log | process | className | event | function | this is a log',
  'Tue, 06 Jul 2021 13:18:24 GMT | error | process | className | event | function | this is an error',
  'Tue, 06 Jul 2021 13:18:24 GMT | warn | process | className | event | function | this is a warning',
  'Tue, 06 Jul 2021 13:18:24 GMT | info | process | className | event | function | this is info'
]
De
*/

Options

log

debux.log(string | null, Options?) logs a simple informative log

error

debux.error(string, Options?) logs an error

warn

debux.warn(string, Options?) logs a warning

info

debux.info(string, Options?) logs information about code

interface Options {
    process?: string;// the process this log was created on
    class?: string;// the class this log was created in
    function?: string;// the function this log came from
    event?: string;// the event this log is apart of
}

interface constructOptions {
    maxCacheSize?: number;// how many logs to cache at a time
    logLevel?: level;// which logs should be logged into console directly
    includeMilliseconds?: boolean;// whether to include milliseconds in the date string
    logFile?: PathLike;// optional path to a file where to write all logs
}

export enum level {
    nothing = 0,// won't log anything to console
    error = 1,// only logs errors
    warning = 2,// logs warnings and errors
    info = 3,// logs info, warnings and errors
    all = 4// logs everything
}

Copyright (c) 2022 MatteZ02

debux's People

Contributors

mattez02 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

debux's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.