Giter Club home page Giter Club logo

idiomatic-console's People

Contributors

jonseymour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

idiomatic-console's Issues

composability of global rebindings for modules that use idiomatic-console

idiomatic-console suffers from its own composability problem.

One use case for idiomatic-console is to globally rebind the output of the calls to the global console API to some other place.

Ironically, this becomes harder to achieve as more modules use idiomatic-stdio to manage their own console output, because these modules are no longer directly bound to the single global console object.

I am contemplating a good way to fix this. It may involve overloading the function of lock() to configure the console object that is used to back private console objects (currently they are backed by the original, global console object, in future they may be backed by the object established by lock)

Log file date stamp

In the case of redirecting console output to a file, is there any way of prefixing the output with a date stamp before it gets written to the file?

defer binding initialization to point of use

Currently, the streams used in the .DIAGNOSTICS and .DATA object are the streams present at the point that the idiomatic-console module was initialized. It would probably be better to defer this initialization until the point of the rebind &/or the point of use since something, somewhere may have decided to patch process.stdout and process.stderr with alternatives.

Consider the best way to do this.

add a log4j like configuration scheme for private console objects.

The idea is to allow the default bindings used by a node module to be configured externally, as in a log4j configuration file.

Modules would obtain a private console object, and global configuration would determine how that console object behaves. Adapters could be built for popular node.js logging systems.

Changes in progress.

I am going to make the following changes.

  • to enforce the rule that at most one top-level module can globally rebind the console object, there will be a pattern like this:
var unlock = console.lock();
try {
   // application code.
} finally {
    unlock();
}
  • push() and pop() wil be removed from the public API.
  • the API produced by rebind() will inherit always inherit its prototype more or less directly from the global console object
  • the API produced by rebind() will always inherit bindings from its parent

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.