PyCharm日志输出颜色 [英] PyCharm logging output colours

查看:2411
本文介绍了PyCharm日志输出颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PyCharm在Mac OS X中开发GAE应用程序。有什么方法可以在PyCharm的运行控制台中显示颜色吗?



我已经设置一个的响应:更改第55行从sys.stderr到sys.stdout的片段。标准输出流总是用红色标记,而标准输出不是。



现在颜色显示正确。

解决方案

Pycharm本身不支持该功能,但是您可以下载Grep控制台插件:
http://plugins.jetbrains.com/plugin/7125?pr=pycharm
并根据需要设置颜色



以下是截图:
http://插件.jetbrains.com / files / 7125 / screenshot_14104.png (链接已死)

我希望它有点帮助:)虽然它不会不提供完全彩色的控制台,但它向它迈出了一步

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:

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.

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.

解决方案

Pycharm doesn't support that feature natively, however you can download Grep console plugin: http://plugins.jetbrains.com/plugin/7125?pr=pycharm and set the colors as you like

here's a screenshot: http://plugins.jetbrains.com/files/7125/screenshot_14104.png (link is dead)

I hope it helps somewhat :) although it doesn't provide fully colorized console, but its a step towards it

这篇关于PyCharm日志输出颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆