Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imcf/jython-scijava-logging

:snake::coffee::bookmark_tabs: Jython package for using SciJava's LogService for logging.
https://github.com/imcf/jython-scijava-logging

imagej2 jython jython-library logging scijava

Last synced: about 2 months ago
JSON representation

:snake::coffee::bookmark_tabs: Jython package for using SciJava's LogService for logging.

Awesome Lists containing this project

README

        

# SciJava log handler for Python 🐍☕📑

[![DOI](https://zenodo.org/badge/154402009.svg)][doi]

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

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

## Example usage

The code in [extra/scripts/example.py](extra/scripts/example.py) demonstrates
how to use the handler in an ImageJ2 Python script utilizing the fabulous
[Script Parameters][ij_script_params] 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:

```log
[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) ---
```

[imcf]: https://www.biozentrum.unibas.ch/imcf
[imagej]: https://imagej.net
[ij_logging]: https://imagej.net/Logging
[ij_script_params]: http://imagej.net/Script_Parameters
[py_logging]: https://docs.python.org/2/library/logging.html
[gh_scijava]: https://github.com/scijava
[gh_sj_logservice]: https://github.com/scijava/scijava-common/tree/master/src/main/java/org/scijava/log
[doi]: https://zenodo.org/badge/latestdoi/154402009