How to use tinytim - 6 common examples

To help you get started, we’ve selected a few tinytim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github physiii / open-automation / node_modules / tracer / lib / dailyfile.js View on Github external
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
        });
    }
github physiii / open-automation / node_modules / tracer / lib / console.js View on Github external
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;
}
github baryon / tracer / lib / console.js View on Github external
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);
	});
github baryon / tracer / lib / dailyfile.js View on Github external
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
        });
    }
github screwdriver-cd / screwdriver / plugins / pipelines / jobBadge.js View on Github external
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
    });
}
github screwdriver-cd / screwdriver / plugins / pipelines / badge.js View on Github external
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
    });
}

tinytim

Node.js port of tinytim (A tiny, secure JavaScript micro-templating script)

MIT
Latest version published 10 years ago

Package Health Score

47 / 100
Full package analysis

Popular tinytim functions