-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
62 lines (53 loc) · 1.36 KB
/
utils.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const winston = require('winston');
const utils = winston.createLogger({
transports: [
new winston.transports.Console(),
new winston.transports.File({filename: 'log'})
]
});
//todo create debug log level
const debug = function (message) {
utils.log({
level: 'info',
nivel: 'debug000',
time: new Date(),
message: message
});
}
exports.debug = debug;
const info = function (message) {
utils.log({
level: 'info',
time: new Date(),
message: message
});
}
exports.info = info;
const args = process.argv.slice(2);
exports.getUrl = function getUrl() {
const url = args[0];
if (url === undefined || url === "") {
info("Exiting url is not defined in the params");
process.exit(1);
}
info("Working on url: " + url);
return url;
}
exports.getMusicUrl = function getMusicUrl() {
const url = args[1];
if (url === undefined || url === "") {
info("Exiting - music url is not defined");
process.exit(1);
}
info("Working on music url: " + url);
return url;
}
exports.getRtmpUrl = function getRtmpUrl() {
const rtmpUrl = args[2];
if (rtmpUrl == null || rtmpUrl === "") {
info("Exiting, rtmp url is not defined in the params");
process.exit(1);
}
info("Rtmp Url: " + rtmpUrl);
return rtmpUrl;
}