Skip to main content

Tungl (Islandic for Moon) Logging Library

Tungl is a small portable logging library we wrote internally for some of our projects.

Release Notes

VersionComment
v0.1.7 Fixed typo in SX-Aurora code.
v0.1.6 Added detection of rank within multi-process application (NEC MPI, OpenMPI and TorchRun).
v0.1.5 Bugfixing for NCC compiler.
v0.1.4 Code refactoring.
v0.1.3 Added module and sep options to Python API.
v0.1.2 Lowered requirements to be Python3.6 compatible.
v0.1.1 Added TUNGL_TIME env var.
v0.1.0 Initial Release

How to use?

Tungl can be either be used by directly using the Tungl API:

#include <tungl/api.h>
tungl_log(TUNGL_LEVEL_INFO, "MyModule", __FILE__, __LINE__, "Message %i", variable);

or via the C and C++ macros.

#define L_MODULE "MyModule"
#include <tungl/c.h> // C-style Macros
L_INFO("Message %i", variable);
#define L_MODULE "MyModule"
#include <tungl/cxx.h> // C++-style Macros
L_INFO("Message " << variable);

Available macros (in both API's are):

#define L_STR(...)                       // transforms L_STR(abc) to "abc"
#define L_INFO(...)                      // prints INFO message
#define L_ERROR(...)                     // prints ERROR message
#define L_WARN(...)                      // prints WARN message
#define L_DEBUG(...)                     // prints DEBUG message
#define L_TRACE(...)                     // prints TRACE message
#define THROWAT(MODULE, FILE, LINE, ...) // throws ERROR message and kills the application, reporting FILE and LINE
#define THROW(...)                       // throws ERROR message and kills the application
#define THROWIF(COND, ...)               // throws ERROR message if COND is fulfilled
#define ASSERT(COND)                     // checks COND and prints COND if not successful
#define FAIL()                           // throws "Implementation Error"
#define TODO(...)                        // throws TODO message

or in python!

import tungl
tungl.set_module('my awesome python application')
tungl.get_module()
tungl.set_level(tungl.Level.[ERROR, INFO, WARN, DEBUG, TRACE])
tungl.info ("Message!", file=__file__)
tungl.trace("Message!", file=__file__)
tungl.error("Message!", file=__file__)
tungl.warn ("Message!", file=__file__)
tungl.debug("Message!", file=__file__)
tungl.throw("Message!", file=__file__)
# there is no convenient way to automatically determine the line in Python,
# BUT you can set it manually if you like.

Advanced features

TUNGL_LOG=[INFO, WARN, ERROR, DEBUG, TRACE], tungl_set_level(tungl_log_level_t) or tungl_set_level_str(const char*) can be used to set the log level.

Tungl also supports to write a copy of the log directly to a file using TUNGL_FILE=/any/valid/file/name or tungl_set_file(const char*). All colors will be stripped before writing to the file.

TUNGL_COLOR=OFF can be used to disable color output.

How to build?

python3 -m install illyrian

git clone ...

mkdir tungl/build
cd tungl/build

# Option 1: Local installation (default CMAKE_INSTALL_PREFIX=/usr/local/ve)
illyrian cmake -DTungl_DIST_TYPE=LOCAL ..
cmake --build . --target install

# Option 2: Python package
illyrian cmake -DTungl_DIST_TYPE=PYTHON ..
cmake --build . --target dist

Metadata

Release files for tungl 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tungl 0.1.7
File Interpreter ABI Platform
tungl-0.1.7-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details

Release files / tungl-0.1.7-py3-none-manylinux_2_17_x86_64.whl

Download URL tungl-0.1.7-py3-none-manylinux_2_17_x86_64.whl
Size 119.6 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4f7fdf8f8979fe2e0b9e3495ed97362e8b9485835703a8cf299a0696fdc530af
BLAKE2b-256 checksum
How to use checksums
47540c8949a3a86f437b90f19ac7e5c614285a2bca732a82fc19cd41fd9f5089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for tungl 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page