GithubHelp home page GithubHelp logo

telefonicaid / logops Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 14.0 401 KB

Really simple and performant logger for node projects compatible with any kind of deployments as your server operations/environment defined

Home Page: https://telefonicaid.github.io/logops/

License: Apache License 2.0

JavaScript 96.63% TypeScript 3.37%
logger logs

logops's People

Contributors

dependabot[bot] avatar dmoranj avatar jason-fox avatar jmendiara avatar juandebravo avatar labajo avatar palmerabollo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logops's Issues

Disable logging for specific paths

I am using this library for an app that serves web pages. I am interested in logging the requests sent to my "functional" endpoints but I really don't want to log each and every request that the browser sends to get static content (images, css, javascript, etc). Would it be possible to disable logging for specific paths?

Dynamic context properties

Allow not prefixed context properties

logger.info({some: 'value'}, 'This is %s', 'Sparta');
// {"time":"2015-06-23T10:13:49.879Z","lvl":"INFO","some":"value","msg":"This is Sparta"}

Related to #5

Add a simple way to disable logs

A logger.setLevel('OFF') or logger.stream = null would make it easier to disable logs.
I'd prefer the logger.stream = null alternative. Do you accept pull requests for this?

Logops v2 tracking issue

As #36 discussion says, we are going to start working in the v2 release to address Breaking changes from node v6 that we have inherited

  • Make master node < 6 compatible. Bump 1.0.8 [#38]
  • Create release/1.X branch and 1.0.8 tag
  • Set master to be v2 code, only with node > 6 compatible code [#39]
  • Release 1.0.8
  • Set deprecation notice in npm v < 1.0.7
  • Bump and Release 2.0.0

Support for child loggers

So each one can have its own behaviour regarding to which context should use.

Use case for express

const app = express();

app.use((req, res, next) => {
  req.logger = logops.child({
    getContext() {
      return { 
        transactionId: uuid.v4()
     }
  };
  next();
});

app.use((req, res, next) => {
  req.logger.info('With request specific context!');
})

Use "NA" instead of "n/a"

When op/corr/trans is not available, use the "standard" "NA" instead of "n/a". This should go to 1.x because it could break backwards compatibility.

Behaviour with missing placeholders

With [email protected] logger.info("test", 1, 2)fails with:

TypeError: Object.keys called on non-object
    at Function.keys (native)
    at /private/tmp/node_modules/logops/lib/formatters.js:158:12
    at Array.forEach (native)
    at Object.formatJsonTrace [as format] (/private/tmp/node_modules/logops/lib/formatters.js:156:8)
    at logWrap (/private/tmp/node_modules/logops/lib/logops.js:76:15)
    at repl:1:9
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.emit (events.js:95:17)
    at Interface._onLine (readline.js:203:10)

The user should use placeholders, but logops should handle that case and not crash in any case.

Simplify README.md

The usage seems much more difficult than it is. I think that:

  • dev info (grunt, lint, test...) should be moved to a different .md file
  • advanced usage tips (context, delegated context support, customization, advanced writing to files) could go to different .md files
  • context vars (corr, trans, op) are telefonica specific and shouldn't be included by default in this module (that could wait for a 1.x release if it breaks backwards compatibility). I think that formatter could be moved to a logops-tef or something like that.

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.