Coder Social home page Coder Social logo

Comments (6)

cool-RR avatar cool-RR commented on May 19, 2024

More details please.

from pysnooper.

836304831 avatar 836304831 commented on May 19, 2024

maybe add a switch for this decorator will be better.
We develop a project has two model: development environment and production environment,generally speaking,we want to this decorator works for dev environment, not production environment. if add a switch, we can close this decorator in production environment and not comment the decorator.

like this:
`
def snoop(output=None, variables=(), depth=1, prefix='', switch=True):
write = get_write_function(output)
@decorator.decorator
def decorate(function, *args, **kwargs):
target_code_object = function.code
if switch:
with Tracer(target_code_object=target_code_object,
write=write, variables=variables,
depth=depth, prefix=prefix):
return function(*args, **kwargs)
else:
return function(*args, **kwargs)

return decorate`

from pysnooper.

cool-RR avatar cool-RR commented on May 19, 2024

I'm against that. Changing to switch=False is about as easy as commenting out or removing the decorator, and the latter is much clearer. This is a tool for debugging, not meant to be checked into Git or used in production.

from pysnooper.

836304831 avatar 836304831 commented on May 19, 2024

I need remove the decorotor befor deploy my project to production environment if I use this decorator for debugging, this process need to modify code(maybe just remove the decorator), maybe It will bring out unpredictable errors or exceptions.

from pysnooper.

cool-RR avatar cool-RR commented on May 19, 2024

It's normal that you'd remove the decorator before deploying to production.

from pysnooper.

836304831 avatar 836304831 commented on May 19, 2024

ok, thanks.

from pysnooper.

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.