robot.output package

Package for internal logging and other output.

Not part of the public API, and also subject to change in the future when test execution is refactored.

Subpackages

Submodules

robot.output.debugfile module

robot.output.debugfile.DebugFile(path)[source]

robot.output.filelogger module

class robot.output.filelogger.FileLogger(path, level)[source]

Bases: AbstractLogger, LoggerApi

message(msg)[source]
start_suite(data, result)[source]
end_suite(data, result)[source]
start_test(data, result)[source]
end_test(data, result)[source]
start_body_item(data, result)[source]
end_body_item(data, result)[source]
result_file(kind, path)[source]

Called when any result file is closed by default.

kind specifies the file type. This method is not called if a result file specific method like output_file() is implemented.

close()[source]

robot.output.librarylogger module

Implementation of the public logging API for libraries.

This is exposed via robot.api.logger. Implementation must reside here to avoid cyclic imports.

robot.output.librarylogger.write(msg: str | Callable[[], str], level: str, html: bool = False)[source]
robot.output.librarylogger.trace(msg, html=False)[source]
robot.output.librarylogger.debug(msg, html=False)[source]
robot.output.librarylogger.info(msg, html=False, also_console=False)[source]
robot.output.librarylogger.warn(msg, html=False)[source]
robot.output.librarylogger.error(msg, html=False)[source]
robot.output.librarylogger.console(msg: str, newline: bool = True, stream: str = 'stdout')[source]

robot.output.listeners module

class robot.output.listeners.Listeners(listeners=(), log_level='INFO')[source]

Bases: object

property listeners
set_log_level(level)[source]
class robot.output.listeners.LibraryListeners(log_level='INFO')[source]

Bases: Listeners

property listeners
new_suite_scope()[source]
discard_suite_scope()[source]
register(library)[source]
unregister(library, close=False)[source]
class robot.output.listeners.ListenerFacade(listener, name, is_logged, library=None)[source]

Bases: LoggerApi, ABC

class robot.output.listeners.ListenerV3Facade(listener, name, is_logged, library=None)[source]

Bases: ListenerFacade

start_user_keyword(data, implementation, result)[source]
end_user_keyword(data, implementation, result)[source]
start_library_keyword(data, implementation, result)[source]
end_library_keyword(data, implementation, result)[source]
start_invalid_keyword(data, implementation, result)[source]
end_invalid_keyword(data, implementation, result)[source]
log_message(message)[source]
class robot.output.listeners.ListenerV2Facade(listener, name, is_logged, library=None)[source]

Bases: ListenerFacade

start_suite(data, result)[source]
end_suite(data, result)[source]
start_test(data, result)[source]
end_test(data, result)[source]
start_keyword(data, result)[source]
end_keyword(data, result)[source]
start_for(data, result)[source]
end_for(data, result)[source]
start_for_iteration(data, result)[source]
end_for_iteration(data, result)[source]
start_while(data, result)[source]
end_while(data, result)[source]
start_while_iteration(data, result)[source]
end_while_iteration(data, result)[source]
start_if_branch(data, result)[source]
end_if_branch(data, result)[source]
start_try_branch(data, result)[source]
end_try_branch(data, result)[source]
start_return(data, result)[source]
end_return(data, result)[source]
start_continue(data, result)[source]
end_continue(data, result)[source]
start_break(data, result)[source]
end_break(data, result)[source]
start_error(data, result)[source]
end_error(data, result)[source]
start_var(data, result)[source]
end_var(data, result)[source]
log_message(message)[source]
message(message)[source]
library_import(library, importer)[source]
resource_import(resource, importer)[source]
variables_import(attrs: dict, importer)[source]
output_file(path: Path)[source]

Called when XML output file is closed.

Calls result_file() by default.

report_file(path: Path)[source]

Called when report file is closed.

Calls result_file() by default.

log_file(path: Path)[source]

Called when log file is closed.

Calls result_file() by default.

xunit_file(path: Path)[source]

Called when xunit file is closed.

Calls result_file() by default.

debug_file(path: Path)[source]

Called when debug file is closed.

Calls result_file() by default.

close()[source]
class robot.output.listeners.ListenerMethod(method, name)[source]

Bases: object

called = False

robot.output.logger module

robot.output.logger.start_body_item(method)[source]
robot.output.logger.end_body_item(method)[source]
class robot.output.logger.Logger(register_console_logger=True)[source]

Bases: AbstractLogger

A global logger proxy to delegating messages to registered loggers.

Whenever something is written to LOGGER in code, all registered loggers are notified. Messages are also cached and cached messages written to new loggers when they are registered.

NOTE: This API is likely to change in future versions.

property start_loggers
property end_loggers
register_console_logger(type='verbose', width=78, colors='AUTO', links='AUTO', markers='AUTO', stdout=None, stderr=None)[source]
unregister_console_logger()[source]
register_syslog(path=None, level='INFO')[source]
register_xml_logger(logger)[source]
unregister_xml_logger()[source]
register_listeners(listeners, library_listeners)[source]
register_logger(*loggers)[source]
unregister_logger(*loggers)[source]
disable_message_cache()[source]
register_error_listener(listener)[source]
message(msg)[source]

Messages about what the framework is doing, warnings, errors, …

property cache_only
property delayed_logging
log_message(msg)

Messages about what the framework is doing, warnings, errors, …

log_output(output)[source]
enable_library_import_logging()[source]
disable_library_import_logging()[source]
start_suite(data, result)[source]
end_suite(data, result)[source]
start_test(data, result)[source]
end_test(data, result)[source]
start_keyword(*args)[source]
end_keyword(*args)[source]
start_user_keyword(*args)[source]
end_user_keyword(*args)[source]
start_library_keyword(*args)[source]
end_library_keyword(*args)[source]
start_invalid_keyword(*args)[source]
end_invalid_keyword(*args)[source]
start_for(*args)[source]
end_for(*args)[source]
start_for_iteration(*args)[source]
end_for_iteration(*args)[source]
start_while(*args)[source]
end_while(*args)[source]
start_while_iteration(*args)[source]
end_while_iteration(*args)[source]
start_if(*args)[source]
end_if(*args)[source]
start_if_branch(*args)[source]
end_if_branch(*args)[source]
start_try(*args)[source]
end_try(*args)[source]
start_try_branch(*args)[source]
end_try_branch(*args)[source]
start_var(*args)[source]
end_var(*args)[source]
start_break(*args)[source]
end_break(*args)[source]
start_continue(*args)[source]
end_continue(*args)[source]
start_return(*args)[source]
end_return(*args)[source]
start_error(*args)[source]
end_error(*args)[source]
library_import(library, importer)[source]
resource_import(resource, importer)[source]
variables_import(variables, importer)[source]
output_file(path)[source]
report_file(path)[source]
log_file(path)[source]
xunit_file(path)[source]
debug_file(path)[source]
result_file(kind, path)[source]
close()[source]

robot.output.loggerapi module

class robot.output.loggerapi.LoggerApi[source]

Bases: object

start_suite(data: running.TestSuite, result: result.TestSuite)[source]
end_suite(data: running.TestSuite, result: result.TestSuite)[source]
start_test(data: running.TestCase, result: result.TestCase)[source]
end_test(data: running.TestCase, result: result.TestCase)[source]
start_keyword(data: running.Keyword, result: result.Keyword)[source]
end_keyword(data: running.Keyword, result: result.Keyword)[source]
start_user_keyword(data: running.Keyword, implementation: running.UserKeyword, result: result.Keyword)[source]
end_user_keyword(data: running.Keyword, implementation: running.UserKeyword, result: result.Keyword)[source]
start_library_keyword(data: running.Keyword, implementation: running.LibraryKeyword, result: result.Keyword)[source]
end_library_keyword(data: running.Keyword, implementation: running.LibraryKeyword, result: result.Keyword)[source]
start_invalid_keyword(data: running.Keyword, implementation: running.KeywordImplementation, result: result.Keyword)[source]
end_invalid_keyword(data: running.Keyword, implementation: running.KeywordImplementation, result: result.Keyword)[source]
start_for(data: running.For, result: result.For)[source]
end_for(data: running.For, result: result.For)[source]
start_for_iteration(data: running.ForIteration, result: result.ForIteration)[source]
end_for_iteration(data: running.ForIteration, result: result.ForIteration)[source]
start_while(data: running.While, result: result.While)[source]
end_while(data: running.While, result: result.While)[source]
start_while_iteration(data: running.WhileIteration, result: result.WhileIteration)[source]
end_while_iteration(data: running.WhileIteration, result: result.WhileIteration)[source]
start_if(data: running.If, result: result.If)[source]
end_if(data: running.If, result: result.If)[source]
start_if_branch(data: running.IfBranch, result: result.IfBranch)[source]
end_if_branch(data: running.IfBranch, result: result.IfBranch)[source]
start_try(data: running.Try, result: result.Try)[source]
end_try(data: running.Try, result: result.Try)[source]
start_try_branch(data: running.TryBranch, result: result.TryBranch)[source]
end_try_branch(data: running.TryBranch, result: result.TryBranch)[source]
start_var(data: running.Var, result: result.Var)[source]
end_var(data: running.Var, result: result.Var)[source]
start_break(data: running.Break, result: result.Break)[source]
end_break(data: running.Break, result: result.Break)[source]
start_continue(data: running.Continue, result: result.Continue)[source]
end_continue(data: running.Continue, result: result.Continue)[source]
start_return(data: running.Return, result: result.Return)[source]
end_return(data: running.Return, result: result.Return)[source]
start_error(data: running.Error, result: result.Error)[source]
end_error(data: running.Error, result: result.Error)[source]
start_body_item(data, result)[source]
end_body_item(data, result)[source]
log_message(message: model.Message)[source]
message(message: model.Message)[source]
output_file(path: Path)[source]

Called when XML output file is closed.

Calls result_file() by default.

report_file(path: Path)[source]

Called when report file is closed.

Calls result_file() by default.

log_file(path: Path)[source]

Called when log file is closed.

Calls result_file() by default.

xunit_file(path: Path)[source]

Called when xunit file is closed.

Calls result_file() by default.

debug_file(path: Path)[source]

Called when debug file is closed.

Calls result_file() by default.

result_file(kind: Literal['Output', 'Report', 'Log', 'XUnit', 'Debug'], path: Path)[source]

Called when any result file is closed by default.

kind specifies the file type. This method is not called if a result file specific method like output_file() is implemented.

imported(import_type: str, name: str, attrs)[source]
library_import(library: running.TestLibrary, importer: running.Import)[source]
resource_import(resource: running.ResourceFile, importer: running.Import)[source]
variables_import(attrs: dict, importer: running.Import)[source]
close()[source]

robot.output.loggerhelper module

robot.output.loggerhelper.write_to_console(msg, newline=True, stream='stdout')[source]
class robot.output.loggerhelper.AbstractLogger(level='TRACE')[source]

Bases: object

set_level(level)[source]
trace(msg)[source]
debug(msg)[source]
info(msg)[source]
warn(msg)[source]
fail(msg)[source]
skip(msg)[source]
error(msg)[source]
write(message, level, html=False)[source]
message(msg)[source]
class robot.output.loggerhelper.Message(message: str | Callable[[], str], level: Literal['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FAIL', 'SKIP', 'HTML', 'CONSOLE'] = 'INFO', html: bool = False, timestamp: datetime | str | None = None)[source]

Bases: Message

property message: str
resolve_delayed_message()[source]
class robot.output.loggerhelper.IsLogged(level)[source]

Bases: object

set_level(level)[source]
classmethod validate_level(level)[source]

robot.output.output module

class robot.output.output.Output(settings)[source]

Bases: AbstractLogger, LoggerApi

property initial_log_level
register_error_listener(listener)[source]
property delayed_logging
close(result)[source]
start_suite(data, result)[source]
end_suite(data, result)[source]
start_test(data, result)[source]
end_test(data, result)[source]
start_keyword(data, result)[source]
end_keyword(data, result)[source]
start_user_keyword(data, implementation, result)[source]
end_user_keyword(data, implementation, result)[source]
start_library_keyword(data, implementation, result)[source]
end_library_keyword(data, implementation, result)[source]
start_invalid_keyword(data, implementation, result)[source]
end_invalid_keyword(data, implementation, result)[source]
start_for(data, result)[source]
end_for(data, result)[source]
start_for_iteration(data, result)[source]
end_for_iteration(data, result)[source]
start_while(data, result)[source]
end_while(data, result)[source]
start_while_iteration(data, result)[source]
end_while_iteration(data, result)[source]
start_if(data, result)[source]
end_if(data, result)[source]
start_if_branch(data, result)[source]
end_if_branch(data, result)[source]
start_try(data, result)[source]
end_try(data, result)[source]
start_try_branch(data, result)[source]
end_try_branch(data, result)[source]
start_var(data, result)[source]
end_var(data, result)[source]
start_break(data, result)[source]
end_break(data, result)[source]
start_continue(data, result)[source]
end_continue(data, result)[source]
start_return(data, result)[source]
end_return(data, result)[source]
start_error(data, result)[source]
end_error(data, result)[source]
message(msg)[source]
trace(msg, write_if_flat=True)[source]
set_log_level(level)[source]

robot.output.pyloggingconf module

robot.output.pyloggingconf.robot_handler_enabled(level)[source]
robot.output.pyloggingconf.set_level(level)[source]
class robot.output.pyloggingconf.RobotHandler(level=0, library_logger=<module 'robot.output.librarylogger' from '/home/docs/checkouts/readthedocs.org/user_builds/robot-framework/checkouts/master/src/robot/output/librarylogger.py'>)[source]

Bases: Handler

Initializes the instance - basically setting the formatter to None and the filter list to empty.

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

robot.output.stdoutlogsplitter module

class robot.output.stdoutlogsplitter.StdoutLogSplitter(output)[source]

Bases: object

Splits messages logged through stdout (or stderr) into Message objects

robot.output.xmllogger module

class robot.output.xmllogger.XmlLoggerAdapter(path, log_level='TRACE', rpa=False, generator='Robot', legacy_output=False)[source]

Bases: LoggerApi

property flatten_level
close()[source]
set_log_level(level)[source]
start_suite(data, result)[source]
end_suite(data, result)[source]
start_test(data, result)[source]
end_test(data, result)[source]
start_keyword(data, result)[source]
end_keyword(data, result)[source]
start_for(data, result)[source]
end_for(data, result)[source]
start_for_iteration(data, result)[source]
end_for_iteration(data, result)[source]
start_while(data, result)[source]
end_while(data, result)[source]
start_while_iteration(data, result)[source]
end_while_iteration(data, result)[source]
start_if(data, result)[source]
end_if(data, result)[source]
start_if_branch(data, result)[source]
end_if_branch(data, result)[source]
start_try(data, result)[source]
end_try(data, result)[source]
start_try_branch(data, result)[source]
end_try_branch(data, result)[source]
start_var(data, result)[source]
end_var(data, result)[source]
start_break(data, result)[source]
end_break(data, result)[source]
start_continue(data, result)[source]
end_continue(data, result)[source]
start_return(data, result)[source]
end_return(data, result)[source]
start_error(data, result)[source]
end_error(data, result)[source]
log_message(message)[source]
message(message)[source]
class robot.output.xmllogger.XmlLogger(output, log_level='TRACE', rpa=False, generator='Robot', suite_only=False)[source]

Bases: ResultVisitor

close()[source]
set_log_level(level)[source]
message(msg)[source]
log_message(msg)[source]
start_keyword(kw)[source]

Called when a keyword starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_keyword(kw)[source]

Called when a keyword ends.

By default, calls end_body_item() which, by default, does nothing.

start_if(if_)[source]

Called when an IF/ELSE structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_if(if_)[source]

Called when an IF/ELSE structure ends.

By default, calls end_body_item() which, by default, does nothing.

start_if_branch(branch)[source]

Called when an IF/ELSE branch starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_if_branch(branch)[source]

Called when an IF/ELSE branch ends.

By default, calls end_body_item() which, by default, does nothing.

start_for(for_)[source]

Called when a FOR loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_for(for_)[source]

Called when a FOR loop ends.

By default, calls end_body_item() which, by default, does nothing.

start_for_iteration(iteration)[source]

Called when a FOR loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_for_iteration(iteration)[source]

Called when a FOR loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

start_try(root)[source]

Called when a TRY/EXCEPT structure starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_try(root)[source]

Called when a TRY/EXCEPT structure ends.

By default, calls end_body_item() which, by default, does nothing.

start_try_branch(branch)[source]

Called when TRY, EXCEPT, ELSE or FINALLY branches start.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_try_branch(branch)[source]

Called when TRY, EXCEPT, ELSE and FINALLY branches end.

By default, calls end_body_item() which, by default, does nothing.

start_while(while_)[source]

Called when a WHILE loop starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_while(while_)[source]

Called when a WHILE loop ends.

By default, calls end_body_item() which, by default, does nothing.

start_while_iteration(iteration)[source]

Called when a WHILE loop iteration starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_while_iteration(iteration)[source]

Called when a WHILE loop iteration ends.

By default, calls end_body_item() which, by default, does nothing.

start_var(var)[source]

Called when a VAR element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_var(var)[source]

Called when a VAR element ends.

By default, calls end_body_item() which, by default, does nothing.

start_return(return_)[source]

Called when a RETURN element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_return(return_)[source]

Called when a RETURN element ends.

By default, calls end_body_item() which, by default, does nothing.

start_continue(continue_)[source]

Called when a CONTINUE element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_continue(continue_)[source]

Called when a CONTINUE element ends.

By default, calls end_body_item() which, by default, does nothing.

start_break(break_)[source]

Called when a BREAK element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_break(break_)[source]

Called when a BREAK element ends.

By default, calls end_body_item() which, by default, does nothing.

start_error(error)[source]

Called when a ERROR element starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

end_error(error)[source]

Called when a ERROR element ends.

By default, calls end_body_item() which, by default, does nothing.

start_test(test)[source]

Called when a test starts. Default implementation does nothing.

Can return explicit False to stop visiting.

end_test(test)[source]

Called when a test ends. Default implementation does nothing.

start_suite(suite)[source]

Called when a suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

end_suite(suite)[source]

Called when a suite ends. Default implementation does nothing.

start_statistics(stats)[source]
end_statistics(stats)[source]
start_total_statistics(total_stats)[source]
end_total_statistics(total_stats)[source]
start_tag_statistics(tag_stats)[source]
end_tag_statistics(tag_stats)[source]
start_suite_statistics(tag_stats)[source]
end_suite_statistics(tag_stats)[source]
visit_stat(stat)[source]
start_errors(errors=None)[source]
end_errors(errors=None)[source]
class robot.output.xmllogger.LegacyXmlLogger(output, log_level='TRACE', rpa=False, generator='Robot', suite_only=False)[source]

Bases: XmlLogger