Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
robotbackgroundlogger
Advanced tools
A helper module for logging to Robot Framework log from background threads.
.. default-role:: code
This helper module is indented to be used by Robot Framework test libraries
that run keywords in background using threads and that want those threads
to be able to log. By default, as explained in Robot Framework User Guide
__,
messages logged by threads using the programmatic APIs are ignored, and results
of logging using the standard output are undefined.
This module provides a custom logger that works mostly like the standard
robot.api.logger
__, but also stores messages logged by background threads.
It also provides a method the main thread can use to forward the logged
messages to Robot Framework's log.
Robot Background Logger is hosted in Github
__ and downloads can be found
from PYPI
__. Installation is easiest done with pip::
pip install robotbackgroundlogger
Starting from version 1.2 this module support both Python 2 and Python 3.
__ http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#communication-when-using-threads __ https://robot-framework.readthedocs.org/en/latest/autodoc/robot.api.html#module-robot.api.logger __ https://github.com/robotframework/robotbackgroundlogger __ https://pypi.python.org/pypi/robotbackgroundlogger
The logger can be taken into use like this:
.. sourcecode:: python
from robotbackgroundlogger import BackgroundLogger
logger = BackgroundLogger()
After that logger
can be used mostly like robot.api.logger
:
.. sourcecode:: python
logger.debug('Hello, world!')
logger.info('<b>HTML</b> example', html=True)
When used by the main thread, messages will be logged immediately exactly like
with robot.api.logger
. When used by other threads, messages will be stored
internally. They can be later logged by the main thread by running:
.. sourcecode:: python
logger.log_background_messages()
If you want to log only messages logged by a certain thread, you can use pass the name of the thread as an argument:
.. sourcecode:: python
logger.log_background_messages('Example thread')
Logged messages are also removed from the internal message storage. It is possible to do that also without logging:
.. sourcecode:: python
# Remove all messages
logger.reset_background_messages()
# Remove messages logged by the named thread
logger.reset_background_messages('Another thread')
example.py
__ library that is used by example.robot
__ shows how this
module can be used in practice. You can run the example like::
pybot example.robot
__ https://github.com/robotframework/robotbackgroundlogger/blob/master/example.py __ https://github.com/robotframework/robotbackgroundlogger/blob/master/example.robot
FAQs
A helper module for logging to Robot Framework log from background threads.
We found that robotbackgroundlogger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.