1
# Copyright 2014 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Utilities for logging."""
6
from __future__ import (
19
from functools import wraps
22
from provisioningserver.logger.log import get_maas_logger
25
maaslog = get_maas_logger("calls")
28
def log_call(level=logging.INFO):
29
"""Log to the maaslog that something happened with a task.
31
:param event: The event that we want to log.
32
:param task_name: The name of the task.
33
:**kwargs: A dict of args passed to the task.
37
def wrapper(*args, **kwargs):
38
arg_string = "%s %s" % (args, kwargs)
40
level, "Starting task '%s' with args: %s" %
41
(func.__name__, arg_string))
44
level, "Finished task '%s' with args: %s" %
45
(func.__name__, arg_string))