jlaamanen / logita Goto Github PK
View Code? Open in Web Editor NEWSimplistic logging for node.js with extensive TypeScript support.
License: ISC License
Simplistic logging for node.js with extensive TypeScript support.
License: ISC License
JSON.parse
reports an error on "unexpected token" at the end of each line when trying to parse expected-stdout.txt or expected-stderr.txt.
Would be nice to have a log span function, along with the current "normal" log functions.
string
message should be supported? (doesn't make a lot of sense to show objects etc. in such split time messages)Maybe the best way to do this in logger object API is to add a span
function beside the log level functions. This would make log levels named span
prohibited, but maybe that's OK...
API usage example draft
import log from "./log";
// Log level must be given as a parameter now
const requestSpan = log.span("debug", "Many async actions");
// => [Mon, 21 May 2018 19:31:09 GMT] /app/src/index.ts:3:24 [DEBUG] "Many async actions" started
doSomethingThatTakesTenSeconds().then(() => {
requestSpan.splitTime("First split time");
// => [Mon, 21 May 2018 19:31:19 GMT] /app/src/index.ts:5:14 [DEBUG] "Many async actions": First split time 10.0s (+10.0s)
return doSomethingThatTakesFiveSeconds();
}).then(() => {
requestSpan.splitTime("Second split time");
// => [Mon, 21 May 2018 19:31:24 GMT] /app/src/index.ts:8:14 [DEBUG] "Many async actions": Second split time 15.0s (+5.0s)
return doSomethingThatTakesThreeSeconds();
}).then(() => {
requestSpan.success();
// [Mon, 21 May 2018 19:31:27 GMT] /app/src/index.ts:11:14 [DEBUG] "Many async actions" successful in 18.0s
}).catch(() => {
// Possibility to override original log level here (maybe in success too)?
requestSpan.fail("fatal");
// => [Mon, 21 May 2018 19:31:27 GMT] /app/src/index.ts:14:14 [FATAL] "Many async actions" failed in 18.0s
});
To use Coveralls, its token must be entered to Travis environment variables. However, when the environment variable is chosen to be hidden in build logs, Travis somehow messes up/strips stdout
and stderr
streams out of escape sequences. This is why all Chalk coloring and formatting fails, making the unit tests fail too.
Related to travis-ci/travis-ci#7967, double-check when it gets fixed.
It might be more useful to display relative file paths instead of absolute paths, because absolute paths might get too long. Maybe add support for relative paths in options?
Logita was primarily designed for terminals with dark background, which is why white text color is used by default e.g. in span names and log level brackets. The logging should work out-of-the-box being as color neutral as possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.