RsOsp Logger

Check the usage in the Getting Started chapter here.

class ScpiLogger[source]

Base class for SCPI logging

mode

Sets / returns the Logging mode.

Data Type

LoggingMode

default_mode

Sets / returns the default logging mode. You can recall the default mode by calling the logger.mode = LoggingMode.Default

Data Type

LoggingMode

device_name: str

Use this property to change the resource name in the log from the default Resource Name (e.g. TCPIP::192.168.2.101::INSTR) to another name e.g. ‘MySigGen1’.

set_logging_target(target, console_log: Optional[bool] = None) None[source]

Sets logging target - the target must implement write() and flush(). You can optionally set the console logging ON or OFF.

log_to_console: bool

Sets the status of logging to the console. Default value is False.

info_raw(log_entry: str, add_new_line: bool = True) None[source]

Method for logging the raw string without any formatting.

info(start_time: datetime.datetime, end_time: datetime.datetime, log_string_info: str, log_string: str) None[source]

Method for logging one info entry. For binary log_string, use the info_bin()

error(start_time: datetime.datetime, end_time: datetime.datetime, log_string_info: str, log_string: str) None[source]

Method for logging one error entry.

log_status_check_ok

Sets / returns the current status of status checking OK. If True (default), the log contains logging of the status checking ‘Status check: OK’. If False, the ‘Status check: OK’ is skipped - the log is more compact. Errors will still be logged.

Data Type

boolean

clear_cached_entries() None[source]

Clears potential cached log entries. Cached log entries are generated when the Logging is ON, but no target has been defined yet.

set_format_string(value: str, line_divider: str = '\n') None[source]

Sets new format string and line divider. If you just want to set the line divider, set the format string value=None The original format string is: PAD_LEFT12(%START_TIME%) PAD_LEFT25(%DEVICE_NAME%) PAD_LEFT12(%DURATION%)  %LOG_STRING_INFO%: %LOG_STRING%

restore_format_string() None[source]

Restores the original format string and the line divider to LF

abbreviated_max_len_ascii: int

Defines the maximum length of one ASCII log entry. Default value is 200 characters.

abbreviated_max_len_bin: int

Defines the maximum length of one Binary log entry. Default value is 2048 bytes.

abbreviated_max_len_list: int

Defines the maximum length of one list entry. Default value is 100 elements.

bin_line_block_size: int

Defines number of bytes to display in one line. Default value is 16 bytes.