Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #204
Easiest to review by commit.
Note that there will be two new files that are created in the root of the repo containing all log messages:
logs/django.log
logs/root.log
The first will contain log messages that are created by django itself, and the second will contain anything emitted by a
logger.<log_level>('some message')
line. Log rotation is enabled by default (to avoid eating up all disk space on the host with an ever-growing log file).The format looks like:
Which gives you information about the log level used, when the log was emitted, the module and function (along with the line number of the log line) that emitted the message, followed by the message itself.
Note the new additions to
.env.example
, which will also need to be carried over to the deployment's.env
file. (Note the enum of possible levels: only logs at the level set in the config file (or higher) will make it into the log file--everything with a lower level is dropped. This is nice for things likelogger.debug("some message")
, because you can leave them in the code and they wouldn't be printed on the production service where the log level might beINFO
, for example, but would be printed when you're developing in debug mode. (As compared to aprint
that's emitted all the time, or needs to constantly be commented and un-commented out)I converted over all existing
print
s to logs using whatever log level.