busimus / cutelog

GUI for logging
MIT License
479 stars 45 forks source link
gui log logging python qt

cutelog – GUI for logging

PyPi

This is a graphical log viewer for Python's logging module. It can be targeted with a SocketHandler with no additional setup (see Usage).

It can also be used from other languages or logging libraries with little effort (see the Wiki). For example, a Go library gocutelog shows how to enable regular Go logging libraries to connect to cutelog.

Features

Screenshots

Light theme Dark theme

Installation

If you're using Linux, install PyQt5 (or PySide2) from your package manager before installing cutelog (package name is probably python3-pyqt5 or python-pyqt5). Or just run pip install pyqt5 to install it from pip, which is sub-optimal.

$ pip install cutelog

Or install the latest development version from the source (requires PyQt5 to build resources):

$ pip install git+https://github.com/busimus/cutelog.git

Requirements

Usage

  1. Start cutelog
  2. Put the following into your code:
    
    import logging
    from logging.handlers import SocketHandler

log = logging.getLogger('Root logger') log.setLevel(1) # to send all records to cutelog socket_handler = SocketHandler('127.0.0.1', 19996) # default listening address log.addHandler(socket_handler) log.info('Hello world!')


Afterwards it's recommended to designate different loggers for different parts of your program with `log_2 = log.getChild("Child logger")`.
This will create "log namespaces" which allow you to filter out messages from various subsystems of your program.

## Attributions
Free software used:
* Qt via either:
    * [PyQt5](https://riverbankcomputing.com/software/pyqt/intro) - GPLv3 License, Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
    * [PySide2](https://wiki.qt.io/PySide2) - LGPLv3 License, Copyright (C) 2015 The Qt Company Ltd (http://www.qt.io/licensing/)
* [QtPy](https://github.com/spyder-ide/qtpy) - MIT License, Copyright (c) 2011- QtPy contributors and others
* [jsonstream](https://github.com/Dunes/json_stream) - MIT License, Copyright (c) 2020 Dunes
* [ion-icons](https://github.com/ionic-team/ionicons) - MIT License, Copyright (c) 2015-present Ionic (http://ionic.io/)

And thanks to [logview](https://pythonhosted.org/logview/) by Vinay Sajip for UI inspiration.

### Copyright and license
This program is released under the MIT License (see LICENSE file).

Copyright © 2023 bus and contributors.