Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function LogFile(prefix, date) {
this.date = date;
this.path = tinytim.tim(_conf.logPathFormat, {root: _conf.root, prefix: prefix, date: date});
checkLogFile(_conf.root);
this.stream = fs.createWriteStream(this.path, {
flags: "a",
encoding: "utf8",
mode: parseInt('0644', 8)
// When engines node >= 4.0.0, following notation will be better:
//mode: 0o644
});
}
if (sp && sp.length === 5) {
data.method = sp[1];
data.path = sp[2];
data.line = sp[3];
data.pos = sp[4];
data.file = path.basename(data.path);
data.stack = stacklist.join('\n');
}
}
config.preprocess(data);
var msg = utils.format.apply(config, data.args);
data.message = msg;
// call micro-template to ouput
data.output = tinytim.tim(format, data);
// process every filter method
var len = filters.length;
for ( var i = 0; i < len; i += 1) {
data.output = fwrap(filters[i])(data.output);
if (!data.output)
return data;
// cancel next process if return a false(include null, undefined)
}
// trans the final result
config.transport.forEach(function(tras) {
tras(data);
});
return data;
}
data.pos = sp[4];
data.folder = path.dirname(config.rootDir && path.isAbsolute(config.rootDir)
? data.path.replace(new RegExp('^'+config.rootDir+path.sep+'?'), '')
: path.resolve(data.path));
data.file = path.basename(data.path);
data.stack = stacklist.join('\n');
}
}
config.preprocess(data);
var msg = utils.format.apply(config, data.args);
data.message = msg;
// call micro-template to ouput
data.output = tinytim.tim(format, data);
// save unprocessed output
data.rawoutput = data.output;
// process every filter method
var len = filters.length;
for ( var i = 0; i < len; i += 1) {
data.output = fwrap(filters[i])(data.output);
if (!data.output)
return data;
// cancel next process if return a false(include null, undefined)
}
// trans the final result
config.transport.forEach(function(tras) {
tras(data);
});
function LogFile(prefix, date) {
this.date = date;
this.path = tinytim.tim(_conf.logPathFormat, {root: _conf.root, prefix: prefix, date: date});
checkLogFile(_conf.root);
this.stream = fs.createWriteStream(this.path, {
flags: "a",
encoding: "utf8",
mode: parseInt('0644', 8)
// When engines node >= 4.0.0, following notation will be better:
//mode: 0o644
});
}
function getUrl({ badgeService, statusColor, encodeBadgeSubject, builds = [], subject = 'job' }) {
let color = 'lightgrey';
let status = 'unknown';
if (builds.length > 0) {
status = builds[0].status.toLowerCase();
color = statusColor[status];
}
return tinytim.tim(badgeService, {
subject: encodeBadgeSubject({ badgeService, subject }),
status,
color
});
}
let worst = 'lightgrey';
const levels = Object.keys(statusColor);
buildsStatus.forEach((status) => {
counts[status] = (counts[status] || 0) + 1;
});
levels.forEach((status) => {
if (counts[status]) {
parts.push(`${counts[status]} ${status}`);
worst = statusColor[status];
}
});
return tinytim.tim(badgeService, {
subject: encodeBadgeSubject({ badgeService, subject }),
status: parts.length > 0 ? parts.join(', ') : 'unknown',
color: worst
});
}