Coder Social home page Coder Social logo

Logging about node-wot HOT 10 CLOSED

mkovatsc avatar mkovatsc commented on July 20, 2024 1
Logging

from node-wot.

Comments (10)

danielpeintner avatar danielpeintner commented on July 20, 2024 1

As mentioned, I would like to solve it as follows.

Add a link in the main README.md to https://github.com/eclipse/thingweb.node-wot/labels/faq to make it more prominent/visible.
However, I suggest closing the issue because it is not an issue and we avoid going over checking unresolved issues that will never be closed.

However I am fine either way...

from node-wot.

relu91 avatar relu91 commented on July 20, 2024 1

I have to be blamed for the current logging API. I choose the current spec because I had the feeling that at the time the consensus was not to use any library for logging. Here is what the current README is reporting:

We used to have a node-wot-logger package to allow fine-grained logging (by means of Winston). It turned out though that depending on the actual use-case other logging libraries might be better suited. Hence we do not want to prescribe which logging library to use. Having said that, we use console statements which can be easily overridden to use the preferred logging library if needed (see here).

So that's why I used a conservative approach and just define a logging practise for node-wot. The statement there still feels a little bit cryptic to me, cause I don't really understand the reasons why it was chosen to not use a logging library. @danielpeintner do you remember which were the conflicting use cases, that cannot be covered with something like debug?

One missing feature that I would like to have is the ability to control debug levels using an env variable as other libraries do.

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I suggest collecting frequently asked questions instead of keeping issues open.

Any opinion
@egekorkan @sebastiankb @wiresio

We could also link the label from README.md
see https://github.com/eclipse/thingweb.node-wot/labels/FAQ

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I noticed we do have a question label also.

I think we need to decide what to do here

from node-wot.

egekorkan avatar egekorkan commented on July 20, 2024

I would leave it open since it doesn't seem to have an answer if someone were to look at it, coming from an FAQ page.

from node-wot.

egekorkan avatar egekorkan commented on July 20, 2024

I see now, all good by me :)

from node-wot.

JKRhb avatar JKRhb commented on July 20, 2024

Copied from thingweb/node-wot#77

On the way to production, we need to include proper logging. We could use the debug module, which is good for library modules and frameworks (e.g., used by express):

const debug = require('debug')('my-namespace')
const name = 'my-app'
debug('booting %s', name)

I wanted to revisit this issue as I think that it would be great if we could replace the current console.debug solution with something like the debug module as it was mentioned by @mkovatsc. At the moment, all the debug messages create a lot of noise when using node-wot in an actual application and it would be great if we had some mechanism for enabling or disabling them.

The debug module allows for this and also adds visual highlighting to distinguish different types of debug messages (e. g. one for each package). However, there might also be alternatives which could be used instead.

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I think it needs better documentation but I guess you can do quite a lot already.

See this example after line

https://github.com/danielpeintner/wot-demo-pv-ecar/blob/2724e56bb1f92c3ce5c6bfc036da989dc5923f6c/charge-spot/charge-spot.js#L24

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

To be honest I do not really recall all aspects.

I recall that some people wanted to use library X and others library Y. We did not want to force anyone to use X or Y in production, meaning that in the end several logging libraries are needed for an application/system. I guess a plugin logging library like in Java was something what we were looking for.

Having said that, I still think our current way of logging is okay 👍

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

resolved by #783

use debug module for logging

from node-wot.

Related Issues (20)

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.