Skip to content

🐍☕📑 Jython package for using SciJava's LogService for logging.

License

Notifications You must be signed in to change notification settings

imcf/jython-scijava-logging

Repository files navigation

SciJava log handler for Python 🐍☕📑

DOI

A very thin Python package (mavenized for ImageJ2) to use the SciJava LogService as a handler for Python's logging facility. See the wiki page about Logging for more details about ImageJ's logging framework.

Developed and provided by the Imaging Core Facility (IMCF) of the Biozentrum, University of Basel, Switzerland.

🚫 WARNING 🚫

The PyPI packages of this project are exclusively useful for automatic testing of e.g. the imcflibs package! They have no real use-case in the standard CPython world 🐍🌍!

Example usage

The code in extra/scripts/example.py demonstrates how to use the handler in an ImageJ2 Python script utilizing the fabulous Script Parameters for retrieving the LogService instance.

Running this code from ImageJ will result in the following messages being printed to the console or the Log window, depending on how you launch ImageJ:

[Fri Jan  5 12:25:15 CET 2018] [ERROR] +++ new round of messages (level WARNING) +++
[Fri Jan  5 12:25:15 CET 2018] [WARNING] warn log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] error log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] critical log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] --- finished round of messages (level WARNING) ---
[Fri Jan  5 12:25:15 CET 2018] [ERROR] +++ new round of messages (level INFO) +++
[Fri Jan  5 12:25:15 CET 2018] [INFO] info log message
[Fri Jan  5 12:25:15 CET 2018] [WARNING] warn log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] error log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] critical log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] --- finished round of messages (level INFO) ---
[Fri Jan  5 12:25:15 CET 2018] [ERROR] +++ new round of messages (level DEBUG) +++
[Fri Jan  5 12:25:15 CET 2018] [DEBUG] debug log message
[Fri Jan  5 12:25:15 CET 2018] [INFO] info log message
[Fri Jan  5 12:25:15 CET 2018] [WARNING] warn log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] error log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] critical log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] --- finished round of messages (level DEBUG) ---
[Fri Jan  5 12:25:15 CET 2018] [ERROR] +++ new round of messages (level WARNING) +++
[Fri Jan  5 12:25:15 CET 2018] [WARNING] warn log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] error log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] critical log message
[Fri Jan  5 12:25:15 CET 2018] [ERROR] --- finished round of messages (level WARNING) ---