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.

Submodules

robot.output.debugfile module

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

robot.output.filelogger module

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

Bases: robot.output.loggerhelper.AbstractLogger

message(msg)[source]
start_suite(suite)[source]
end_suite(suite)[source]
start_test(test)[source]
end_test(test)[source]
start_keyword(kw)[source]
end_keyword(kw)[source]
output_file(name, path)[source]
close()[source]
debug(msg)
error(msg)
fail(msg)
info(msg)
set_level(level)
trace(msg)
warn(msg)
write(message, level, html=False)

robot.output.librarylogger module

Implementation of the public test library logging API.

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

robot.output.librarylogger.write(msg, level, html=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, newline=True, stream='stdout')[source]

robot.output.listenerarguments module

class robot.output.listenerarguments.ListenerArguments(arguments)[source]

Bases: object

get_arguments(version)[source]
classmethod by_method_name(name, arguments)[source]
class robot.output.listenerarguments.MessageArguments(arguments)[source]

Bases: robot.output.listenerarguments.ListenerArguments

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.StartSuiteArguments(arguments)[source]

Bases: robot.output.listenerarguments._ListenerArgumentsFromItem

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.EndSuiteArguments(arguments)[source]

Bases: robot.output.listenerarguments.StartSuiteArguments

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.StartTestArguments(arguments)[source]

Bases: robot.output.listenerarguments._ListenerArgumentsFromItem

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.EndTestArguments(arguments)[source]

Bases: robot.output.listenerarguments.StartTestArguments

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.StartKeywordArguments(arguments)[source]

Bases: robot.output.listenerarguments._ListenerArgumentsFromItem

by_method_name(name, arguments)
get_arguments(version)
class robot.output.listenerarguments.EndKeywordArguments(arguments)[source]

Bases: robot.output.listenerarguments.StartKeywordArguments

by_method_name(name, arguments)
get_arguments(version)

robot.output.listenermethods module

class robot.output.listenermethods.ListenerMethods(method_name, listeners)[source]

Bases: object

class robot.output.listenermethods.LibraryListenerMethods(method_name)[source]

Bases: object

new_suite_scope()[source]
discard_suite_scope()[source]
register(listeners, library)[source]
unregister(library)[source]
class robot.output.listenermethods.ListenerMethod(method, listener, library=None)[source]

Bases: object

called = False

robot.output.listeners module

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

Bases: object

set_log_level(level)[source]
log_message(msg)[source]
imported(import_type, name, attrs)[source]
output_file(file_type, path)[source]
class robot.output.listeners.LibraryListeners(log_level='INFO')[source]

Bases: object

register(listeners, library)[source]
unregister(library, close=False)[source]
new_suite_scope()[source]
discard_suite_scope()[source]
set_log_level(level)[source]
log_message(msg)[source]
imported(import_type, name, attrs)[source]
output_file(file_type, path)[source]
class robot.output.listeners.ListenerProxy(listener, method_names, prefix=None)[source]

Bases: robot.output.loggerhelper.AbstractLoggerProxy

classmethod import_listeners(listeners, method_names, prefix=None, raise_on_error=False)[source]

robot.output.logger module

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

Bases: robot.output.loggerhelper.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.

start_loggers
end_loggers
register_console_logger(type='verbose', width=78, colors='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, ...

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(suite)[source]
end_suite(suite)[source]
start_test(test)[source]
end_test(test)[source]
start_keyword(keyword)[source]
end_keyword(keyword)[source]
imported(import_type, name, **attrs)[source]
output_file(file_type, path)[source]

Finished output, report, log, debug, or xunit file

close()[source]
debug(msg)
error(msg)
fail(msg)
info(msg)
set_level(level)
trace(msg)
warn(msg)
write(message, level, html=False)
class robot.output.logger.LoggerProxy(logger, method_names=None, prefix=None)[source]

Bases: robot.output.loggerhelper.AbstractLoggerProxy

robot.output.loggerhelper module

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]
error(msg)[source]
write(message, level, html=False)[source]
message(msg)[source]
class robot.output.loggerhelper.Message(message, level='INFO', html=False, timestamp=None)[source]

Bases: robot.model.message.Message

timestamp
message
copy(**attributes)

Return shallow copy of this object.

Parameters:attributes – Attributes to be set for the returned copy automatically. For example, test.copy(name='New name').

See also deepcopy(). The difference between these two is the same as with the standard copy.copy and copy.deepcopy functions that these methods also use internally.

New in Robot Framework 3.0.1.

deepcopy(**attributes)

Return deep copy of this object.

Parameters:attributes – Attributes to be set for the returned copy automatically. For example, test.deepcopy(name='New name').

See also copy(). The difference between these two is the same as with the standard copy.copy and copy.deepcopy functions that these methods also use internally.

New in Robot Framework 3.0.1.

html
html_message

Returns the message content as HTML.

level
parent
visit(visitor)[source]

Visitor interface entry-point.

class robot.output.loggerhelper.IsLogged(level)[source]

Bases: object

set_level(level)[source]
class robot.output.loggerhelper.AbstractLoggerProxy(logger, method_names=None, prefix=None)[source]

Bases: object

robot.output.output module

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

Bases: robot.output.loggerhelper.AbstractLogger

register_error_listener(listener)[source]
close(result)[source]
start_suite(suite)[source]
end_suite(suite)[source]
start_test(test)[source]
end_test(test)[source]
start_keyword(kw)[source]
end_keyword(kw)[source]
message(msg)[source]
set_log_level(level)[source]
debug(msg)
error(msg)
fail(msg)
info(msg)
set_level(level)
trace(msg)
warn(msg)
write(message, level, html=False)

robot.output.pyloggingconf module

robot.output.pyloggingconf.robot_handler_enabled(*args, **kwds)[source]
robot.output.pyloggingconf.set_level(level)[source]
class robot.output.pyloggingconf.RobotHandler(level=0)[source]

Bases: logging.Handler

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

emit(record)[source]
acquire()

Acquire the I/O thread lock.

addFilter(filter)

Add the specified filter to this handler.

close()

Tidy up any resources used by the handler.

This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.

createLock()

Acquire a thread lock for serializing access to the underlying I/O.

filter(record)

Determine if a record is loggable by consulting all the filters.

The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.

flush()

Ensure all logging output has been flushed.

This version does nothing and is intended to be implemented by subclasses.

format(record)

Format the specified record.

If a formatter is set, use it. Otherwise, use the default formatter for the module.

get_name()
handle(record)

Conditionally emit the specified logging record.

Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.

handleError(record)

Handle errors which occur during an emit() call.

This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.

name
release()

Release the I/O thread lock.

removeFilter(filter)

Remove the specified filter from this handler.

setFormatter(fmt)

Set the formatter for this handler.

setLevel(level)

Set the logging level of this handler.

set_name(name)

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.XmlLogger(path, log_level='TRACE', generator='Robot')[source]

Bases: robot.result.visitor.ResultVisitor

close()[source]
set_log_level(level)[source]
message(msg)[source]
log_message(msg)[source]
start_keyword(kw)[source]
end_keyword(kw)[source]
start_test(test)[source]
end_test(test)[source]
start_suite(suite)[source]
end_suite(suite)[source]
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]
end_message(msg)

Called when message ends. Default implementation does nothing.

end_result(result)
end_stat(stat)
start_message(msg)

Called when message starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_result(result)
start_stat(stat)
visit_errors(errors)
visit_keyword(kw)

Implements traversing through the keyword and its child keywords.

Can be overridden to allow modifying the passed in kw without calling start_keyword() or end_keyword() nor visiting child keywords.

visit_message(msg)

Implements visiting the message.

Can be overridden to allow modifying the passed in msg without calling start_message() or end_message().

visit_result(result)
visit_statistics(stats)
visit_suite(suite)

Implements traversing through the suite and its direct children.

Can be overridden to allow modifying the passed in suite without calling start_suite() or end_suite() nor visiting child suites, tests or keywords (setup and teardown) at all.

visit_suite_statistics(stats)
visit_tag_statistics(stats)
visit_test(test)

Implements traversing through the test and its keywords.

Can be overridden to allow modifying the passed in test without calling start_test() or end_test() nor visiting keywords.

visit_total_statistics(stats)