Git Product home page Git Product logo

better-debugging.js's Introduction

Logo

better-debugging.js

An advanced but still easy to use debugging tool.

Features:

  • fast and easy-to-use
  • automatic log saving and archiving
  • priority logging
  • url and/or token hiding

Usage

const Debugging = require('better-debugging.js');
const debug = new Debugging.BetterDebugging();

debug.log("Hello World!");
// [INFO] [9.0 MB][2019-04-28T12:49:34.251Z]: Hello World!
// [TYPE] [Memory Usage][DATE AND TIME]: MESSAGE

Example Usage

const Debugging = require('better-debugging.js');
const debug = new Debugging.BetterDebugging({
  archiveFolder: __dirname + '/../archive/',
  debugEnabled: true,
  minPriority: 0,
  hideTokens: false,
  spoofURLs: true
});

debug.log("This is a success! :)", "s");
debug.log("This is a warning?", "w");
debug.log("This is an error!", "e");
debug.log("Error with priority 4.", "e", 4);
debug.log("Only logged if 'debugEnabled' is enabled.", "d");
debug.log("This URL will be spoofed if you enabled so in the options:"
+ "\nhttps://www.youtube.com/watch?v=VvpWQkbyW2A");
debug.log("Also, the token will be hidden here if enabled in the options:"
+ "\nhttps://example.org/api?token=thisIsAToken");

Screenshot

Docs

Object Declaration

const Debugging = require('better-debugging.js');
const debug = new Debugging.BetterDebugging(options);

options (object):

{
  archiveFolder (String): Folder to where logs should be saved, must be a direct link (Default: __dirname + '/archive'),
  debugEnabled (Boolean): Wether to log messages with type "Debug",
  minPriority (Integer): Messages with lower priority won't be logged to console, but will still be saved,
  hideTokens (Boolean): Wether to hide possible tokens in URLs,
  spoofURLs (Boolean): Wether to short URLs in logs
}

Method Calling

debug.log(message, type, priority);

message (string): The message which will be logged in console. type (string): A different type will change the color and formatting of the logged message.

  • "i": Info (Default)
  • "s": Success
  • "w": Warning
  • "e": Error
  • "d": Debug

priority (integer): Priorities are used to differentiate between saved logs.

Saved Logs

Logs are saved to the specific archive folder by this format: archive/type/date_(priority).txt

better-debugging.js's People

Contributors

ishidres avatar

Watchers

 avatar

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.