An advanced but still easy to use debugging tool.
- fast and easy-to-use
- automatic log saving and archiving
- priority logging
- url and/or token hiding
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
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");
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
}
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.
Logs are saved to the specific archive folder by this format:
archive/type
/date
_(priority
).txt