Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logger client #15

Open
patoroco opened this issue Apr 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@patoroco
Copy link

commented Apr 11, 2019

During development, should be really helpful to have a dummy statsd client that instead of try to send the metrics to the real statsd, it just print logs with the metrics that you're trying to send.

@WoLpH

This comment has been minimized.

Copy link
Owner

commented Apr 11, 2019

That's easily done actually :)
First, set the statsd client to point to a non-existing statsd server. Since it uses udp it won't care if the server exists or not, it will silently fail.
Second, set the logging for statsd to info or higher.

So... something along these lines:

# Settings:
STATSD_HOST = '127.0.0.1'
STATSD_PORT = 12345

# Set the log level
import logging
logger = logging.getLogger('statsd')
logger.setLevel(logging.INFO)

# If you don't have any logging setup yet
logger.addHandler(logging.StreamHandler())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.