Git Product home page Git Product logo

Comments (5)

p0pr0ck5 avatar p0pr0ck5 commented on July 26, 2024

Debug statements are most useful when debugging, obviously- those particular statements have been useful in catching mistakes and identifying issues I didn't know where around. Perhaps its time to add some configurable granularity to debug logs?

from lua-resty-waf.

splitice avatar splitice commented on July 26, 2024

Yes and no, its debug logs so they can be a bit verbose. Granularity might be an overkill. Personally I just think logging inside utility functions i.e the _table_ functions to be redundant. These functions should instead be rigorously tested. Application specific logging can then occur outside if necessary.

This also allows for these utility functions to be used in the module context where options are unavailable. I found I needed to do this in my branch a few times (e.g _table_clone on the default options)

from lua-resty-waf.

hy05190134 avatar hy05190134 commented on July 26, 2024

I agree with splitice. Some logging is unnecessary, and I think _log should supply for log level directly, as for the logging content, we should write it before thinking about seriously.

from lua-resty-waf.

p0pr0ck5 avatar p0pr0ck5 commented on July 26, 2024

"Personally I just think logging inside utility functions i.e the table functions to be redundant. These functions should instead be rigorously tested. Application specific logging can then occur outside if necessary."

Yep, the more I look at this, this more I agree. Once I finish breaking out lookup tables and various functions into smaller libraries, we can start unit testing with something like Test::Nginx::Socket::Lua, and the nasty debug logs can go away.

from lua-resty-waf.

p0pr0ck5 avatar p0pr0ck5 commented on July 26, 2024

More work done on this in:

b814a42
feb5763
493391d

If there are suggestions on cleaning this further, feel free to submit a PR :)

from lua-resty-waf.

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.