0.28.2 • Published 6 years ago

gulp-messenger v0.28.2

Weekly downloads
1,938
License
MIT
Repository
github
Last release
6 years ago

gulp-messenger

gulp plugin for browser, command line notification and logging!

Build Status Dependency Status npm npm

View on npm

Install with npm

npm install gulp-messenger

Usage

var msg = require('gulp-messenger');

msg.init(); // initialize module, otherwise defaults will be used

// this example will enable file logging (see options below)
msg.init({logToFile: true});


// this will disable logging to file and interpolation variables will be font style as message (no bold)
var options = { logToFile: false, boldVariables: false };
msg.init(options);


// You can use titleCase or lower case for msg methods
msg.Info('-', 'Loading...', '*');
msg.log    ('style: <%= name %>', {name: 'info'});     // default color White
msg.Info   ('style: <%= name %>', {name: 'info'});     // default color Cyan
msg.Success('style: <%= name %>', {name: 'success'});  // default color Green
msg.Warning('style: <%= name %>', {name: 'warning'});  // default color Yellow
msg.Error  ('style: <%= name %>', {name: 'error'});    // default color Red
msg.Note   ('style: <%= name %>', {name: 'note'});     // default color Orange
msg.Time   ('style: <%= name %>', {name: 'time'});
msg.Debug  ('style: <%= name %>', {name: 'debug'});
msg.Table  (array|object)

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
};

logToFile (default: false)
- will log the supplied message to `logger` instance and log to file

logToConsole (default: true)
- will log message to console

logTimestampFormat (default: YYYY-MM-DD HH:mm:ss Z)
- when logging to file, uses momentjs formats

logPath (default: 'logs/' at root level)
- desired path where log files will be stored

logFile (default: 'app.log')
- desired filename where log files will be stored

timestamp (default: false)
- Will include timestamp on consoled messages

rotateLog (default: false)
- will create a new log file each day

boldVariables (default: true)
- when perform interpolation, the actual variable will be bold

useDumpForObjects (default: true)
- when enabled, is passing a single object paramter, msg.dump() will be used instead of standard console output
- when disabled, native msg.xxx will be used (default colors, etc)

For example info Use msg.info for each file into the stream

msg.Info('This information message logged to console and optionally log file.  Configured by `options` parameter supplied to `msg.init` method');
msg.info('This information message logged to console and optionally log file.  Configured by `options` parameter supplied to `msg.init` method');

or -

// If you using in gulp stream, include the `flush` property as shown here
// All messenger routines (except dump) are supported in the gulp pipleline
gulp.src('src/**/*')
    .pipe(msg.flush.info('Piping Message'));  // 'Piping Message' for each file

Use msg.flush.info at the and of the stream

gulp.src('src/**/*')
    .pipe(msg.flush.info('Process Completed Successfully')); //'Process Completed Successfully' at the and of stream

Use msg.Info from the outside of the stream

msg.Info('Application Message'); //'Application Message' in node.js application

msg.version|msg.Version

Returns current module version

msg.Info(before, message, after,)

Show message

Parameters

before
after

Type: String

Delimiter before/after the message. Each character is repeated 80 times

Usage

msg.Info('--', 'Hello World', '*')
data

Type: Object

Data for message. Inherited values:

message

Type: String

Lodash compatible template (may also use Underscore over Lodash).

Usage

msg.Info('Environment: <%= env.NODE_ENV %>. Name: <%= name %>', {name: 'codedungeon'})
//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


0.28.2

6 years ago

0.28.1

6 years ago

0.28.0

6 years ago

0.27.0

7 years ago

0.26.0

7 years ago

0.25.3

7 years ago

0.25.2

7 years ago

0.25.1

7 years ago

0.25.0

7 years ago

0.24.0

8 years ago

0.22.1

8 years ago

0.22.0

8 years ago

0.21.0

8 years ago

0.20.0

8 years ago

0.19.0

8 years ago

0.18.1

8 years ago

0.18.0

8 years ago

0.17.0

8 years ago

0.16.2

8 years ago

0.16.1

8 years ago

0.16.0

8 years ago

0.15.2

8 years ago

0.15.1

8 years ago

0.15.0

8 years ago

0.14.2

8 years ago

0.14.1

8 years ago

0.14.0

8 years ago

0.13.1

8 years ago

0.13.0

8 years ago

0.12.0

8 years ago

0.11.1

8 years ago

0.11.0

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.7.0

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.43

9 years ago

0.0.42

9 years ago

0.0.41

9 years ago

0.0.40

9 years ago

0.0.36

9 years ago

0.0.35

9 years ago

0.0.34

9 years ago

0.0.32

9 years ago

0.0.31

9 years ago

0.0.28

9 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago