All Projects → matiaslopezd → XDebugger

matiaslopezd / XDebugger

Licence: MIT License
A very lightweight library (4Kb) to create a development or production debugger with custom errors readable for humans. Includes errors in table format, logger and search methods with dynamic filters.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to XDebugger

Bugsnag Ruby
Bugsnag error monitoring & reporting software for rails, sinatra, rack and ruby
Stars: ✭ 211 (+1072.22%)
Mutual labels:  debug, debugging-tool
flutter ume
UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance
Stars: ✭ 1,792 (+9855.56%)
Mutual labels:  debug, debugging-tool
Icecream Cpp
🍦 Never use cout/printf to debug again
Stars: ✭ 225 (+1150%)
Mutual labels:  debug, debugging-tool
pydbg
Python implementation of the Rust `dbg` macro
Stars: ✭ 85 (+372.22%)
Mutual labels:  debug, debugging-tool
ducky
Chrome extension to overlay a (super adorable) rubber duck, as a virtual companion during rubber duck debugging.
Stars: ✭ 80 (+344.44%)
Mutual labels:  debug, debugging-tool
Bugsnag Go
Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
Stars: ✭ 155 (+761.11%)
Mutual labels:  debug, debugging-tool
ifto
A simple debugging module for AWS Lambda (λ) timeout
Stars: ✭ 72 (+300%)
Mutual labels:  debug, debugging-tool
Pandora
an android library for debugging what we care about directly in app.
Stars: ✭ 1,365 (+7483.33%)
Mutual labels:  debug, debugging-tool
dwarf import
This loads DWARF info from an open binary and propagates function names, arguments, and type info
Stars: ✭ 18 (+0%)
Mutual labels:  debug, debugging-tool
bugsnag-vue
[DEPRECATED] This package now lives within the monorepo for our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 26 (+44.44%)
Mutual labels:  debug, debugging-tool
Ololog
A better console.log for the log-driven debugging junkies
Stars: ✭ 141 (+683.33%)
Mutual labels:  debug, debugging-tool
docker-pudb
Debug Python code within a Docker container remotely from your terminal using pudb
Stars: ✭ 18 (+0%)
Mutual labels:  debug, debugging-tool
Gdb Frontend
☕ GDBFrontend is an easy, flexible and extensionable gui debugger.
Stars: ✭ 2,104 (+11588.89%)
Mutual labels:  debug, debugging-tool
Icecream
🍦 Never use print() to debug again.
Stars: ✭ 5,601 (+31016.67%)
Mutual labels:  debug, debugging-tool
Twili
Homebrew debug monitor for the Nintendo Switch.
Stars: ✭ 131 (+627.78%)
Mutual labels:  debug, debugging-tool
arm-hard-fault-handler
What to do when Hard fault hits? Debugger and error reporter solution for ARM Cortex M3 and M4.
Stars: ✭ 32 (+77.78%)
Mutual labels:  debug, debugging-tool
Bugsnag Python
Official bugsnag error monitoring and error reporting for django, flask, tornado and other python apps.
Stars: ✭ 69 (+283.33%)
Mutual labels:  debug, debugging-tool
Strongod
StrongOD(anti anti-debug plugin) driver source code.
Stars: ✭ 76 (+322.22%)
Mutual labels:  debug, debugging-tool
bugsnag-java
Bugsnag error reporting for Java.
Stars: ✭ 51 (+183.33%)
Mutual labels:  debug, debugging-tool
android-sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 39 (+116.67%)
Mutual labels:  debug, debugging-tool

XDebugger

A very lightweight library to create a production debugger with custom errors readable for humans. Includes errors in table format, logger and search methods with dynamic filters.

size-repo license version quality issues

This library with zero dependencies was designed for debug/capture errors in development or production environment and obtain errors in background, with a readable format for any developer, also can disable console logs any time.

  1. Demos
  2. Installation
  3. How to use

Demos

Installation

npm installation:

npm i xdebugger

Or without npm:

<!-- In development environment -->
<script src="xdebugger.js"></script>

<!-- In production environment -->
<script src="xdebugger.min.js" async></script>

How to use

Use XDebugger is really easy and very flexible, it's possible define debug, log, datatypes, action, default and max variables for different logs requirements.

Can use for debug development or in production website. Also if you want for example can load debug parameters via API, like { debug: true, log: false } and obtain errors or custom logs if you set.

In case use npm:

import XDebugger from 'xdebugger';

Basic initialization

// In development environment
const debug = new XDebugger({ debug: true, log: true });

// In production environment
const debug = new XDebugger({ debug: true });

Set { log: false } disable completely console. That's mean XDebugger, clean console for not show any log, info, warn, table and error. If try log anything console show:

  Console was cleared
> console.log("Try write something like this");
"Developer mode is disabled."

How log

You can log any data you want, also XDebugger add by default time as String and timestamp format as Number.

// Obviously you need initialize before!!
// Example log =>

debug.log({
  message: `${value} is not a valid data type`,
  code: 150,
  explanation: `The variable was evaluated and is not valid, typeof ${value}: ${typeof value}.`,
  response: `Change to ${this._datatypes.toString()} data type.`,
  error: `Value expect a ${this._datatypes.toString()} and recieve ${typeof value}`,
})

How to listen errors

window.onerror = (message, url, line, col, err) => debug.log(debug.onerror(message, url, line, col, err));

How to get logs

debug.logged

// Output =>
> [{..}]

How to search / filter logs

Search was based in MongoDB queries for filter. XDebugger have 6 types of filters:

  • $eq: Match value of log key with query value key
  • $cnt: Contains value of log key with query value key
  • $lte: Less or equal value of log key with query value key
  • $gte: More or equal value of log key with query value key
  • $lt: Less value of log key with query value key
  • $gt: More value of log key with query value key

$eq search

// Implicit search
debug.search({
  timestamp: 1556528447311,
  code: 105
});

// Explicit search
debug.search({
  timestamp: {
    $eq: 1556528447311
  },
  code: 401
});

$cnt search

debug.search({
  error: {
    $cnt: "filter"
  },
  internalCode: 9224
});

$lte search

debug.search({
  timestamp: {
    $lte: 1556528447311
  },
  code: 105
});

$lt search

debug.search({
  timestamp: {
    $lt: 1556528447311
  },
  browser: "Google Chrome"
});

$gte search

debug.search({
  timestamp: {
    $gte: 1556528447311
  },
  version: 12.1
});

$gt search

debug.search({
  timestamp: {
    $gt: 1556528447311
  },
  name: "John Doe",
  idUser: "507f191e810c19729de860ea"
});

How set and send log per log to a API

const debug = new Debugger({ debug: true, action: (log) => {
    // Here your code to POST log
  } 
});

How export and download logs

You can export all logs and download in a JSON file.

debug.export();

Also can export filtered logs as follow:

debug.export(debug.search({
  code: 105,
  browser: "Brave"
}));

How console logs in readable format

The view function accept Array or Object, that mean one or more logs.

debug.view(debug.logged);

How to clean debugger

This clean logger and console.

debug.clean();

How set default data

default key in object initialization parameter allow set default data like browser, version, internalCode, etc.

// 'library' as third party source functionality

const debug = new XDebugger({ debug: true, default: {
  browser: library.browser.name,
  version: library.browser.version,
  language: library.browser.lang,
  ...
}});

Also you can rewrite default time and timestamp:

const debug = new XDebugger({ debug: true, default: {
  time: mycustomtime.toString(),
  timestamp: mycustomtime.getTime(),
}});

How set max records and size of values log

  • length: set the max records logger can save
  • size: set the max size value of log allowed in MB, Ex: { key: "value value value value value value value " } => 80 Bytes
const debug = new XDebugger({ debug: true, default: {
  max: {
    length: 60,
    size: 100
  }
}});

datatypes Not tested yet!!

Define allowed data type of log value.

Not tested with functions or other data type.

By default it allow number, string, object.

Try not use complex schema with console.table, that lose the readable format

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].