Skip to main content

robocorp-log

robocorp-log is a library which provides comprehensible logging for Python with a focus on Python automation, where detailed information on what happened and why a failure occurs is of vital importance.

Note: The format of the log is not a part of the API and should not be relied upon as it can change even between minor versions.

Why

Although Python logging is flexible it may be hard to analyze the logging afterwards and visualize it. Also, the format may end up using a big amount of disk space and it may be tedious to add logging calls to all places of interest.

How

robocorp-log improves those aspects by using a structured format which enables using less disk space while also providing a viewer (log.html) for the generated content.

Also, it provides utilities to setup logging so that logging is done automatically without having to explicitly add calls to add content to the logging (although it's still possible to do so when needed).

Usage

It's recommended that robocorp-log is used through robocorp-tasks as robocorp-tasks will configure robocorp-log in a streamlined way, where you just need to worry about marking the entry point method with a @tasks decorator and it'll automatically setup the auto-logging and provide the log result in output/log.html.

Configuring with pyproject.toml

robocorp-tasks takes care of customizing robocorp-log through pyproject.toml.
See the robocorp-tasks project for more information (robocorp-log only provides the core logging structure and different libraries may customize it in different ways).

Although the setup is done through robocorp-tasks, there are still some APIs in robocorp.log which are interesting to use such as:

  • Utility methods to add a log message as critical, warn, info, debug, exception

  • Utility method to add an html message (using the html method). Note that the html method is tested for images with base64 contents in the log.html, other structures must be manually checked as they can break the layout. Also, keep in mind that the provided html will be sanitized.

  • Supressing logging through suppress_variables, suppress_methods, suppress.

  • Hiding sensitive data (automatically based on variable or argument names with names registered in add_sensitive_variable_name and add_sensitive_variable_name_pattern) or by passing the value to be hidden to hide_from_output.

Caveats

The auto import mode is done by having a pre-import hook which will change the AST at runtime. This mostly works, but there are a couple of caveats to keep in mind:

  1. Debuggers may end up stepping into the robocorp-log code in many places even if such code isn't in the source code (you may want to configure the debugger you're using to skip calls into robocorp.log as that's usually just an implementation detail).

  2. The logging needs to be fully setup prior to importing any module that should be automatically logged.

  3. Working with coroutines (async, await and greenlet) is not supported.

Guides

API Reference

Explore our API for extensive documentation.

Changelog

A list of releases and corresponding changes can be found in the changelog.

Metadata

Release files for robocorp-log 3.0.0

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

Source distribution (sdist)

Source distribution for robocorp-log 3.0.0
File Size Uploaded Provenance Actions
robocorp_log-3.0.0.tar.gz 350.3 kB Without provenance Details for robocorp_log-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for robocorp-log 3.0.0
File Interpreter ABI Platform Actions
robocorp_log-3.0.0-py3-none-any.whl Python 3 none any Details for robocorp_log-3.0.0-py3-none-any.whl

Total release size: 709.8 kB

Release files / robocorp_log-3.0.0.tar.gz

Download URL robocorp_log-3.0.0.tar.gz
Size 350.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9abe0dfc3c56e9b50ab7cee43f6d43cddb82faa3d0b0e7ecbcf6e3395015170c
BLAKE2b-256 checksum
How to use checksums
0104c25a8aa44b413eee70febcd800955e88c08c4eaa1fa7691f62df424fa1fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.3 Linux/6.8.0-1021-azure

Release files / robocorp_log-3.0.0-py3-none-any.whl

Download URL robocorp_log-3.0.0-py3-none-any.whl
Size 359.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa65fca532ef3d193d26ae9a05a3b36fbe19653e801d0048f85bf3170d1384ad
BLAKE2b-256 checksum
How to use checksums
e1e6a0bc87dfd418af788127e4198e7d45e7fd19cc94b2e68b22eb1bf273f5aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.3 Linux/6.8.0-1021-azure

Security for robocorp-log 3.0.0

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.

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files No provenance

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