-
Notifications
You must be signed in to change notification settings - Fork 0
/
log-notify.js
43 lines (31 loc) · 1.07 KB
/
log-notify.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
var debug = require('debug')('log-notify');
function log(title) {
var notifier;
title = (title === undefined) ? '' : title;
switch (process.platform) {
case 'darwin':
debug('setting notifier to terminal-notifier');
notifier = require('terminal-notifier');
return function logTerminalNotifier(message) {
var cleanedMessage = typeof message.stripColors === 'string' ? message.stripColors : message;
notifier(cleanedMessage, {
title: title,
activate: 'com.apple.Terminal'
});
console.log(message);
};
case 'linux':
case 'win32':
debug('setting notifier to growl');
notifier = require('growl');
return function logGrowl(message) {
var cleanedMessage = typeof message.stripColors === 'string' ? message.stripColors : message;
notifier(cleanedMessage, { title: title });
console.log(message);
};
default:
return console.log;
}
}
module.exports = log;