gulp-messenger
gulp plugin for browser, command line notification and logging!
View on npm
npm
Install withnpm install gulp-messenger
Usage
var msg = ; msg; // initialize module, otherwise defaults will be used // this example will enable file logging (see options below)msg; // this will disable logging to file and interpolation variables will be font style as message (no bold)var options = logToFile: false boldVariables: false ;msg; // You can use titleCase or lower case for msg methodsmsg;msg; // default color Whitemsg; // default color Cyanmsg; // default color Greenmsg; // default color Yellowmsg; // default color Redmsg; // default color Orangemsg;msg;msg
API
info/Info, success/Success, warning/Warning, error/Error, note/Note, time/Time, debug/Debug, line/Line
- lowercase methods are to be used in gulp pipeline or outside (same API can be used for both Node, Browser, and Gulp)
- Titlecase methods are to be used outside of gulp (ie Node or browser)
Default Options (supplied to init
method)
var defOptions = logToFile: false logTimestampFormat: 'YYYY-MM-DD HH:mm:ss Z' logToConsole: true logPath: 'logs/' logFile: 'app.log' timestamp: false rotateLog: false boldVariables: true useDumpForObjects: true; - will log the supplied message to `logger` instance and log to file - will log message to console - when logging to file uses momentjs formats - desired path where log files will be stored - desired filename where log files will be stored - Will include timestamp on consoled messages - will create a file each day - when perform interpolation the actual variable will be bold - when enabled is passing a single object paramter msg will be used instead of standard console output- when disabled native msgxxx will be
For example info
Use msg.info
for each file into the stream
msg;msg; or - // If you using in gulp stream, include the `flush` property as shown here// All messenger routines (except dump) are supported in the gulp piplelinegulp ; // 'Piping Message' for each file
Use msg.flush.info
at the and of the stream
gulp ; //'Process Completed Successfully' at the and of stream
Use msg.Info
from the outside of the stream
msg; //'Application Message' in node.js application
msg.version|msg.Version
Returns current module version
msg.Info([before,] message, [after,] [data])
Show message
Parameters
before
after
Type: String
Delimiter before/after the message. Each character is repeated 80 times
Usage
msg
data
Type: Object
Data for message. Inherited values:
env - process.env file - vinyl file file.relative - relative path (extra field) file.basename - basename (extra field) duration - duration of streaming totalDuration - duration from gulpfile start
message
Type: String
Lodash compatible template (may also use Underscore over Lodash).
Usage
msg//Environment: dev. name: codedungeon
License
Copyright (c) 2015-2016 Mike Erickson Released under the MIT license
Credits
gulp-messenger written by Mike Erickson
E-Mail: codedungeon@gmail.com
Twitter: @codedungeon
Webiste: codedungeon.org