4

I am from a Java background. In Java you can print at different levels in most frameworks. For example in log4J, you have log levels which can be set to Debug, Info, warn etc.

Does python have anything similar out of the box? i.e. without having to import another lbrary.

Thanks.

1
  • Just a note: you will need to import logging, but logging is a part of the standard library, and will be installed on the machine. Commented Jan 26, 2012 at 23:40

1 Answer 1

10

Yep! Have a look at the logging module. Here's a tutorial.

Sign up to request clarification or add additional context in comments.

2 Comments

This is a highly useful module. It has saved a lot of bloodshed
@Thomas. Thanks a million. Just trying to write good code and this is exactly what I needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.