openlane.logging API

The Logging Module

As the name implies, this handles OpenLane’s logging using the logging module and the rich library.

class openlane.logging.LogLevels(value)

Bases: IntEnum

An enumeration.

class openlane.logging.LevelFilter(levels: Iterable[str], invert: bool = False)

Bases: Filter

Parameters:
  • levels (Iterable[str])

  • invert (bool)

filter(record: LogRecord) bool

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

Parameters:

record (LogRecord)

Return type:

bool

openlane.logging.set_log_level(lv: str | int)

Sets the log level of the default OpenLane logger.

Parameters:

lv (str | int) – Either the name or number of the desired log level.

openlane.logging.reset_log_level()

Sets the log level of the default OpenLane logger back to the default log level.

openlane.logging.get_log_level() int

Obtains the numeric log level of the OpenLane logger.

Return type:

int

openlane.logging.register_additional_handler(handler: Handler)

Adds a new handler to the default OpenLane logger.

Parameters:

handler (Handler) – The new handler. Must be of type logging.Handler or its subclasses.

openlane.logging.deregister_additional_handler(handler: Handler)

Removes a registered handler from the default OpenLane logger.

Parameters:

handler (Handler) – The handler. If not registered, the behavior of this function is undefined.

openlane.logging.verbose(*args, **kwargs)

Logs to the OpenLane logger with the log level VERBOSE.

openlane.logging.debug(*args, **kwargs)

Logs to the OpenLane logger with the log level DEBUG.

Parameters:

msg – The message to log

openlane.logging.info(msg: object, /, **kwargs)

Logs to the OpenLane logger with the log level INFO.

Parameters:

msg (object) – The message to log

openlane.logging.rule(title: str = '', /, **kwargs)

Prints a horizontal line on the terminal enclosing the first argument if the log level is <= INFO.

Kwargs are passed to https://rich.readthedocs.io/en/stable/reference/console.html#rich.console.Console.rule

Parameters:

title (str) – A title string to enclose in the console rule

openlane.logging.success(msg: object, /, **kwargs)

Logs to the OpenLane logger with the log level INFO.

Parameters:

msg (object) – The message to log

openlane.logging.warn(msg: object, /, **kwargs)

Logs to the OpenLane logger with the log level WARNING.

Parameters:

msg (object) – The message to log

openlane.logging.err(msg: object, /, **kwargs)

Logs to the OpenLane logger with the log level ERROR.

Parameters:

msg (object) – The message to log

openlane.logging.subprocess(msg: object, /, **kwargs)

Logs to the OpenLane logger with the log level SUBPROCESS.

Parameters:

msg (object) – The message to log