Giter Club home page Giter Club logo

Comments (9)

mcollina avatar mcollina commented on August 11, 2024 1

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

from fastify-secure-session.

real-artswan avatar real-artswan commented on August 11, 2024

I'll try, but don't you think that it's not a good behavior to write library's internal logs using application's request.log method? Why don't use "debug" module which is kind of a standard approach for a library?
Anyway I'll come back soon when I'll get a chance to discover sources better.

from fastify-secure-session.

real-artswan avatar real-artswan commented on August 11, 2024

BTW, I didn't see these messages before, what was the reason of adding that?

from fastify-secure-session.

mcollina avatar mcollina commented on August 11, 2024

I'm sorry but I don't understand.. those are debug logs. Why is it a problem in including them here?

from fastify-secure-session.

real-artswan avatar real-artswan commented on August 11, 2024

Please take a look at PR, I`m not sure what kind of tests I can add there (btw logging is disabled at all in all existing tests).

Regarding why:
I'd like to keep my logs clean for obvious, I beleive, reasons: when something goes wrong you read the logs and the more usefull information there the better, and more usefull means less water. Settings/unsettings/removing/etc session usually not usefull, I'd like to log if session is set or isn't set by myself in cases when I need it and when I think it is important.
Now I have +1 line (in 99.99% of time it is just repeating line I mentioned in the first post) per each request.
So this PR aims to fix that.
If you need logs for your own debugging) why don't use own logging like https://github.com/visionmedia/debug ? I've been noticing it in many mature products and I use it in my projects - very easy to enable/disable with fine graining.

BTW, A lot of thanks for a perfect library!

from fastify-secure-session.

airhorns avatar airhorns commented on August 11, 2024

Why not just change your log level to something other than debug? They're written at the debug level so that they're only present when you want the most verbose information. I think the default log level for fastify is info, which would hide those logs.

from fastify-secure-session.

real-artswan avatar real-artswan commented on August 11, 2024

Why not just change your log level to something other than debug?

Then I'll lose request/response logs. It would be great if Fastify supported different logLevel for plugins, but, it seems, it's not going to be implemented soon (fastify/fastify#636).

from fastify-secure-session.

airhorns avatar airhorns commented on August 11, 2024

Do you mean request/response bodies? Because the incoming request / request completed logs are at the info level, so if you set the log level to info you'd still see them. Also, there's a PR linked there that would get you back debug logs if you want: fastify/fastify#639 , you'd have to set the level on each route you wanted them for which would be annoying but it's at least possible.

from fastify-secure-session.

real-artswan avatar real-artswan commented on August 11, 2024

ok, guys, nevermind, for a while, I just set log level to "info" when it was "trace". It seems it covers all business requirements.
Anyway (for the sake of justice), I believe, that plugins should not spoil request logs.
Also, one can disable Fasify logging and use hooks to log whatever he want (may be I'll use this approach later as it is more independent and flexible)
Cheers and close that.

from fastify-secure-session.

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.