def format(self, record): """pretify the log output, annotate with simulation time""" if record.args: msg = record.msg % record.args else: msg = record.msg msg = str(msg) level = record.levelname.ljust(_LEVEL_CHARS) timeh, timel = simulator.get_sim_time() return self._format(timeh, timel, level, record, msg)
def format(self, record): """pretify the log output, annotate with simulation time""" if record.args: msg = record.msg % record.args else: msg = record.msg msg = SimColourLogFormatter.loglevel2colour[record.levelno] % msg level = SimColourLogFormatter.loglevel2colour[record.levelno] % \ record.levelname.ljust(_LEVEL_CHARS) timeh, timel = simulator.get_sim_time() return self._format(timeh, timel, level, record, msg)
def get_sim_time(units=None): """Retrieves the simulation time from the simulator Kwargs: units (str): String specifying the units of the result. (None,'fs','ps','ns','us','ms','sec') None will return the raw simulation time. Returns: The simulation time in the specified units """ timeh, timel = simulator.get_sim_time() result = (timeh << 32 | timel) if units is not None: result = get_time_from_sim_steps(result, units) return result
def get_sim_time(units=None): """Retrieves the simulation time from the simulator. Args: units (str or None, optional): String specifying the units of the result (one of ``None``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``). ``None`` will return the raw simulation time. Returns: The simulation time in the specified units. """ timeh, timel = simulator.get_sim_time() result = (timeh << 32 | timel) if units is not None: result = get_time_from_sim_steps(result, units) return result