Git Product home page Git Product logo

logita's People

Stargazers

 avatar

Watchers

 avatar  avatar

logita's Issues

npm test doesn't work on Windows

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.

Log span

Would be nice to have a log span function, along with the current "normal" log functions.

  • Creating a "log span" would start a timer
  • Multiple "split times" could be logged (along with any given text), e.g. after each asynchronous request is complete
  • When the span ends, the "end time" gets logged (similar to "split time")
  • This time, only 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
});

Cannot use Coveralls because of bug in Travis

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.

Better color neutrality by default

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.