src/core/utils/logging.py
def logged(
    name: Optional[str] = None,
    with_margins: bool = True,
    with_arguments: bool = True,
    heading: int = 2
) -> Callable:
  """Logged Wrapper.

  Wraps a function and log its call whenever happens, as well as its parameters and call time.

  Parameters
  ----------
  name: str
    Verbose (human) name of the section being logged.
    If nothing is passed, the name of the function is used instead.
  
  with_margins: bool
    Whether or not to add margins to the logged message.
    Set it to false to produce more compact reports.
  
  with_arguments: bool
    Whether or not to include the arguments of the function in the logged message.
    Set it to false to produce more compact reports.
  
  heading: int, default=2

  Examples
  --------

  >>> @logged('Model Training')
  >>> def training(model, dataset):
  >>>   model.fit(dataset, epochs=10)
  >>>   return model.history.history

  """
  def decorator(fn):
    def _log_wrapper(*args, **kwargs):
      log_begin(
        name or fn.__name__.replace('_', ' '),
        *args,
        with_margins=with_margins,
        with_arguments=with_arguments,
        heading=heading,
        **kwargs
      )
      return fn(*args, **kwargs)
    return _log_wrapper
  return decorator
Logged Wrapper.

  Wraps a function and log its call whenever happens, as well as its parameters and call time.

  Parameters
  ----------
  name: str
    Verbose (human) name of the section being logged.
    If nothing is passed, the name of the function is used instead.
  
  with_margins: bool
    Whether or not to add margins to the logged message.
    Set it to false to produce more compact reports.
  
  with_arguments: bool
    Whether or not to include the arguments of the function in the logged message.
    Set it to false to produce more compact reports.
  
  heading: int, default=2

  Examples
  --------

  >>> @logged('Model Training')
  >>> def training(model, dataset):
  >>>   model.fit(dataset, epochs=10)
  >>>   return model.history.history

  
Logged Wrapper.
Wraps a function and log its call whenever happens, as well as its parameters and call time.

Parameters

str
Verbose (human) name of the section being logged.
If nothing is passed, the name of the function is used instead.

bool
Whether or not to add margins to the logged message.
Set it to false to produce more compact reports.

bool
Whether or not to include the arguments of the function in the logged message.
Set it to false to produce more compact reports.

int, default=2

Examples


Logged Wrapper . Wraps a function and log its call whenever happens as well as its parameters and call time . Parameters str Verbose ( human ) name of the section being logged . If nothing is passed the name of the function is used instead . bool Whether or not to add margins to the logged message . Set it to false to produce more compact reports . bool Whether or not to include the arguments of the function in the logged message . Set it to false to produce more compact reports . int default = 2 Examples
def logged(
    name: Optional[str] = None,
    with_margins: bool = True,
    with_arguments: bool = True,
    heading: int = 2
) -> Callable:
  def decorator(fn):
    def _log_wrapper(*args, **kwargs):
      log_begin(
        name or fn.__name__.replace('_', ' '),
        *args,
        with_margins=with_margins,
        with_arguments=with_arguments,
        heading=heading,
        **kwargs
      )
      return fn(*args, **kwargs)
    return _log_wrapper
  return decorator
def logged ( name : Optional [ str ] = None , with_margins : bool = True , with_arguments : bool = True , heading : int = 2 ) -> Callable : def decorator ( fn ) : def _log_wrapper ( * args , ** kwargs ) : log_begin ( name or fn . __name__ . replace ( '_' , ' ' ) , * args , with_margins = with_margins , with_arguments = with_arguments , heading = heading , ** kwargs ) return fn ( * args , ** kwargs ) return _log_wrapper return decorator
Logged Wrapper.
Logged Wrapper .
"""Logged Wrapper.

  Wraps a function and log its call whenever happens, as well as its parameters and call time.

  Parameters
  ----------
  name: str
    Verbose (human) name of the section being logged.
    If nothing is passed, the name of the function is used instead.
  
  with_margins: bool
    Whether or not to add margins to the logged message.
    Set it to false to produce more compact reports.
  
  with_arguments: bool
    Whether or not to include the arguments of the function in the logged message.
    Set it to false to produce more compact reports.
  
  heading: int, default=2

  Examples
  --------

  >>> @logged('Model Training')
  >>> def training(model, dataset):
  >>>   model.fit(dataset, epochs=10)
  >>>   return model.history.history

  """
name
Optional[str]
with_margins
bool
with_arguments
bool
heading
int