RFC: 3.0 API & Ideas
See original GitHub issueHey 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 (https://github.com/visionmedia/debug/issues/280)
-
(No) Ability to enable/disable debug instances
-
(Maybe) API to overwrite/set environment variables by key (https://github.com/visionmedia/debug/issues/277)
Any other ideas are welcome. I’d love to have a completed first pass draft by the end of next week.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:95 (61 by maintainers)
Top Results From Across the Web
REST API Media Types draft-ietf-httpapi-rest-api-mediatypes-02
Replaces, draft-polli-rest-api-mediatypes. RFC stream, Internet Engineering Task Force (IETF). Intended RFC status, (None). Formats.
Read more >Vue 3.0 Discards Class-Based API for Reusable, Composable ...
The Vue team recently opened an RFC which describes the proposed function-based component API for the upcoming Vue 3.
Read more >OpenAPI Specification - Version 3.0.3 - Swagger
The OpenAPI Specification defines a standard interface to RESTful APIs which allows both humans and computers to understand service capabilities without ...
Read more >OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >[RFC]: Bareflank 3.0 · Issue #884 - GitHub
Port Bareflank to the BSL with the existing APIs. Implement SOLID and Static Interfaces; Add AMD support; Implement all unit tests; Implement ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the most important thing to keep in mind is simplicity. This module is incredibly simple to use; you’ll want to make sure it remains dead simple to use, and is as simple as possible to extend and configure.
I think it will be a great feature to achieve the “Ability to enable/disable specific debugging namespaces at runtime”. Sometimes I want to debug a http server step by step. For examples,
Changing environment variables could also work. Stopping the server, setting different environment variables, restarting server again, and it maybe cost much time for waiting server to start. So it is complicated for the scenario. I desire to debug without shutting down the process.
middleware
is a way to transform data in a pipeline. But how to extend the debug instance itself? To implementdebug.enable(namespace)
anddebug.disable(namespace)
methods. Could you provide any appropriate cases? @thebigredgeek