Closed
Description
Hey everyone,
I figured it's time to start discussing the API for V3.
A few fundamental ideas to get started:
- (No) Code written in ES2015 (minimal transpilation?, no es6 modules)
- (Yes) Robust test coverage
- (Yes) XO Code Styling
- (Yes) "Replaceable middleware" pattern for formatting, output, etc. Extensible. This allows hooks for stuff like logstash and client-to-server log streaming as desired. Middleware is FIFO and debug comes with a default set for formatting, output, environment adaptation, etc. Ex:
//Stdout would be default console.log middleware
import debug, { StdoutMiddleware } from 'debug';
// Add some sort of new middleware element
log.use((data, next) => ... )
// replace Stdout (console.log) with console.info at same position in middleware array
log.replace(StdoutMiddleware, (data, next) => {
console.info.apply(console, data);
next();
});
- (Yes) "Child" debug instances (which inherit middleware from parent debug instances). Ex:
const log1 = debug('foo');
log1.use((data, next) => ... );
const log2 = log.child('bar');
log2('hello world'); // => foo:bar hello world
-
(Yes) Formal organized schema for CHANGELOG.md
-
(Yes) Dead-simple generated documentation
-
(Yes) Time locale configuration
-
(Yes) Stdout moved off of APIs that are pending removal (RFC: 3.0 stdout moved off of APIs that are pending removal #280)
-
(No) Ability to enable/disable debug instances
-
(Maybe) API to overwrite/set environment variables by key (How to use with AWS Lambda (ie. w/o env vars)? #277)
Any other ideas are welcome. I'd love to have a completed first pass draft by the end of next week.