[Python] How does one make logging color in Django/Google App Engine?

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    If one iswriting a Django/ Google App Engine application and would like to have logs that are conveniently conspicuous based on color (i.e. errors in red), how does one set that up?

    I've copied the helpful solution from this question, but I'm not sure how to integrate it into Django/Google App Engine.

    I figured one would put the following in the application's main.py (i.e. essentially from the example here: Running Django on Google App Engine):

    from contrib.utils import ColouredLogger # from the SO question above
    logging.setLoggerClass(ColouredLogger)


    ... where contrib.utils is where I put airmind's code from the above link to his SO answer.

    However, that doesn't seem to do anything to the output to the console for GAE, which continues to be in the original format + plain color.

    Continue reading...

Compartilhe esta Página