Git Product home page Git Product logo

debug-logger's People

Contributors

dmarcelino avatar laggingreflex avatar nemtsov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

debug-logger's Issues

Easy way to turn it on from the file itself?

Hey there, awesome little library you've got here.

I was wondering if you know of a way to easily enable logging from within a given file. For example,

var log = require('debug-logger')('RowView');
log.enable()

If it doesn't exist, would it be difficult to add this as a convenience?

Thanks!

Strings with %

Strings with a % don't display correctly

d.log('11%ab%cdefg');

only outputs:

defg

I.e. everything before the last % and the immediate next character don't display.

logging does not use console

I thought you'd use console, like visionmedia's debug. You did not document that you modify his logging features as such.

Now I get output that is always serialized, and I would like to just expand objects when logging to the browser console...

util.inspect not called for Error objects

I'm using this package together with make-error-cause, which extends errors with a cause property and overrides the custom inspect function to generate a long stack trace including the cause:
https://github.com/blakeembrey/make-error-cause/blob/master/src/index.ts

This module however does not use util.inspect() to generate stack traces, instead it accesses .stack directly so the "extended" stack trace is not printed.

I would appreciate if this could get fixed.

Simple repro case:

process.env.DEBUG = '*';

const { BaseError } = require('make-error-cause');
const log = require('debug-logger')('test');

let cause = new Error('cause');
let e = new BaseError('error', cause);

log.error(e);

Output:

  test:error BaseError: error
  test:error ___Stack trace #1___
  test:error BaseError: error
  test:error     at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
  test:error     at Module._compile (internal/modules/cjs/loader.js:776:30)
  test:error     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
  test:error     at Module.load (internal/modules/cjs/loader.js:643:32)
  test:error     at Function.Module._load (internal/modules/cjs/loader.js:556:12)
  test:error     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
  test:error     at internal/main/run_main_module.js:17:11 +0ms

Expected output:

  test:error BaseError: error
  test:error ___Stack trace #1___
  test:error BaseError: error
  test:error     at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
  test:error     at Module._compile (internal/modules/cjs/loader.js:776:30)
  test:error     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
  test:error     at Module.load (internal/modules/cjs/loader.js:643:32)
  test:error     at Function.Module._load (internal/modules/cjs/loader.js:556:12)
  test:error     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
  test:error     at internal/main/run_main_module.js:17:11
  test:error
  test:error The following exception was the direct cause of the above exception:
  test:error
  test:error Error: cause
  test:error     at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:6:13)
  test:error     at Module._compile (internal/modules/cjs/loader.js:776:30)
  test:error     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
  test:error     at Module.load (internal/modules/cjs/loader.js:643:32)
  test:error     at Function.Module._load (internal/modules/cjs/loader.js:556:12)
  test:error     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
  test:error     at internal/main/run_main_module.js:17:11 +0ms

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.