Built-in listeners (plugins)
February 27, 2017 ยท View on GitHub
Remember the generic way to enable a listener:
import { addListener } from 'storyboard';
import consoleListener from 'storyboard-listener-console';
addListener(consoleListener, options);
The following sections describe the parameters you can pass as options.
Console
Purpose: formats logs and sends them to the console (also in the browser).
Package: storyboard-listener-console
Options:
moduleNameLengthnumber (default:20): number of characters dedicated to thesrcfield (e.g.main,storyboard,httpServer, ...)colorsboolean (default:true): enable/disable colors in output.relativeTimeboolean (default:truebrowser-side,falseotherwise): whether full timestamps are logged, or only relative. IfrelativeTimeis enabled, time differences lower than 10 ms are not displayed, and those higher than 1 s introduce an extra line to make the log more readable.useStderrboolean (default:false): output warning and errors tostderrinstead ofstdout.
Parallel console
Purpose: shows parallel, top-level stories in the console, with support for resizing. It should work correctly in the following terminals:
- OS X: Terminal.app (default terminal), iTerm, Hyper
- Windows: cmd (default terminal), Console 2, Hyper
Package: storyboard-listener-console-parallel
Options:
moduleNameLengthnumber (default:20): number of characters dedicated to thesrcfield (e.g.main,storyboard,httpServer, ...)colorsboolean (default:true): enable/disable colors in output.relativeTimeboolean (default:truebrowser-side,falseotherwise): whether full timestamps are logged, or only relative. IfrelativeTimeis enabled, time differences lower than 10 ms are not displayed, and those higher than 1 s introduce an extra line to make the log more readable.
WebSocket Server
Purpose: encapsulates logs and pushes them in real time to WebSocket clients. Used jointly with the WebSocket Client and Browser Extension, it allows remote access to server stories.
Package: storyboard-listener-ws-server
See usage hints.
Options:
portnumber (default:8090): port for the standalone log server. Set tonullto disable this server (does not affect integration with the existing application HTTP/socket.io server).throttlenumber (default:200): minimum interval to wait between consecutive broadcasts. Set to a falsy value for no throttling.authenticatefunction (default:null): authentication function:credentialsobject:loginandpassword- Returns boolean|Promise of boolean: whether the user is authenticated or not
httpServerobject: anhttpServerinstance, which will be used to provide WebSocket services. Provide eitherhttpServer,socketServeror none.socketServerobject: a socket.ioServerinstance, which will be used to provide WebSocket services. Provide eitherhttpServer,socketServeror none.
WebSocket Client
Purpose: downloads server logs from the WebSocket Server, and optionally uploads client logs to the server for remote monitoring.
Package: storyboard-listener-ws-client
Options:
uploadClientStoriesboolean (default:false): enable this flag for remote access to client storiesthrottleUploadnumber (default:null): minimum interval to wait between consecutive uploads. Set to a falsy value for no throttling.
Browser Extension
Purpose: relays logs to the Storyboard DevTools.
Package: storyboard-listener-browser-extension
No options available.
File
Purpose: saves logs to file.
Package: storyboard-listener-file
Options:
moduleNameLengthnumber (default:20): see Console.colorsboolean (default:false): whether ANSI-color escapes should be kept before saving to file.filePathstring (default:storyboard.log): relative path for the log file. If the file exists, new logs will be appended.
PostgreSQL Database
Purpose: saves logs to a PostgreSQL database for later retrieval, including (serialized) attachments, story hierarchy, etc.
Package: storyboard-listener-db-postgres
Options:
hoststring (default:localhost)portnumber (default:process.env.PGPORT || 5432)databasestring (default:process.env.PGDATABASE)tablestring (default:logEntries)userstring (default:process.env.PGUSER)passwordstring (default:process.env.PGPASSWORD)throttlenumber (default:200): minimum interval to wait between consecutive save operations. Set to a falsy value for no throttling.colorsboolean (default:true): whether ANSI-color escapes should be kept before saving to the database.