#NEWLINE# def logged_if_slow( * args , **kwargs ) : #NEWLINE# #INDENT# "Context manager that logs if operations within take longer than\n    `threshold` seconds.\n\n    :param threshold: Number of seconds (or fractions thereof) allwoed before\n                      logging occurs. The default is 1 second.\n    :param logger: :class:`~logbook.Logger` to use. The default is a 'slow'\n                   logger.\n    :param level: Log level. The default is `DEBUG`.\n    :param func: (Deprecated). Function to call to perform logging.\n\n    The remaining parameters are passed to the\n    :meth:`~logbook.base.LoggerMixin.log` method.\n    " #NEWLINE# threshold = kwargs . pop ( 'threshold' , 1 ) #NEWLINE# func = kwargs . pop ( 'func' , None ) #NEWLINE# if ( func is None ) : #NEWLINE# #INDENT# logger = kwargs . pop ( 'logger' , _slow_logger ) #NEWLINE# level = kwargs . pop ( 'level' , DEBUG ) #NEWLINE# func = functools . partial ( logger . log , level , * args , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( 'logger' in kwargs ) or ( 'level' in kwargs ) ) : #NEWLINE# #INDENT# raise TypeError ( "If using deprecated func parameter, 'logger' and 'level' arguments cannot be passed." ) #NEWLINE# #UNINDENT# func = functools . partial ( func , * args , ** kwargs ) #NEWLINE# #UNINDENT# return _SlowContextNotifier ( threshold , func )