react-server-gulp-module-tagger
A gulp plugin for tagging react-server logger instances with information about the module they're being used in.
To transpile your source for use with React Server, install gulp and the plugin
npm i -D gulp react-server-gulp-module-tagger
Then add the task to your gulpfile
const gulp = ;const tagger = ;gulp;
A compile task might also use Babel with the React Server Babel preset to transpile jsx and es 7 for the browser and the server
const gulp = ;const babel = ;const tagger = ; gulp;
Given a getLogger
call,
adds the correct arguments to keep the server and the browser in sync.
For example, given a module in src/components/my-feature/foo.js
, and using the options
{ trim: 'src.', prefix: 'react-server.' }
let logger = logging;
returns a logger instance that will have consistent coloring on the server and
the client, and that has a human-friendly, readable name that easily maps to
the file tree (in this example react-server.components.my-feature.foo
).
If you need more than one logger in your module, you can distinguish them with labels
var fooLogger = logging;var barLogger = logging;
Two other tokens, __CHANNEL__
and __CACHE__
, are reserved for future use,
and will also be replaced with a module context.