OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

PyCharm logging output colours

  • Thread starter Thread starter dablak
  • Start date Start date
D

dablak

Guest
I'm using PyCharm to develop a GAE app in Mac OS X. Is there any way to display colours in the run console of PyCharm?

I've set a handler to output colours in ansi format. Then, I've added the handler:

Code:
LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
for handler in LOG.handlers:
    LOG.removeHandler(handler)

LOG.addHandler(ColorHandler())

LOG.info('hello!')
LOG.warning('hello!')
LOG.debug('hello!')
LOG.error('hello!')

But the colour is the same.

PyCharm run console output


EDIT:

A response from JetBrains issue tracker: Change line 55 of the snippet from sys.stderr to sys.stdout. stderr stream is always colored with red color while stdout not.

Now colours are properly displayed.
<p>I'm using PyCharm to develop a GAE app in Mac OS X. Is there any way to display colours in the run console of PyCharm?</p>

<p>I've set a <a href="http://xsnippet.org/359377/" rel="noreferrer">handler</a> to output colours in ansi format. Then, I've added the handler:</p>

<pre><code>LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
for handler in LOG.handlers:
LOG.removeHandler(handler)

LOG.addHandler(ColorHandler())

LOG.info('hello!')
LOG.warning('hello!')
LOG.debug('hello!')
LOG.error('hello!')
</code></pre>

<p>But the colour is the same.</p>

<p><img src="https://i.sstatic.net/130xo.png" alt="PyCharm run console output"></p>

<p>EDIT:</p>

<p>A response from JetBrains <a href="http://youtrack.jetbrains.com/issue/PY-11543" rel="noreferrer">issue tracker</a>: Change line 55 of the snippet from sys.stderr to sys.stdout. stderr stream is always colored with red color while stdout not.</p>

<p>Now colours are properly displayed.</p>
 

Latest posts

Top