Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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.
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.
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).
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
.
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
.
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:
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).
The logging needs to be fully setup prior to importing any module that should be automatically logged.
Working with coroutines (async
, await
and greenlet
) is not supported.
Explore our API for extensive documentation.
A list of releases and corresponding changes can be found in the changelog.
FAQs
Automatic trace logging for Python
We found that robocorp-log demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.