Helpers for comparing version strings.
oslo_log.versionutils.
deprecated
(as_of, in_favor_of=None, remove_in=2, what=None)¶A decorator to mark callables as deprecated.
This decorator logs a deprecation message when the callable it decorates is used. The message will include the release where the callable was deprecated, the release where it may be removed and possibly an optional replacement. It also logs a message when a deprecated exception is being caught in a try-except block, but not when subclasses of that exception are being caught.
Examples:
>>> @deprecated(as_of=deprecated.ICEHOUSE)
... def a(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()')
... def b(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=+1)
... def c(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=None)
... def d(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()',
... remove_in=None)
... def e(): pass
Warning
The hook used to detect when a deprecated exception is being caught does not work under Python 3. Deprecated exceptions are still logged if they are thrown.
oslo_log.versionutils.
deprecation_warning
(what, as_of, in_favor_of=None, remove_in=2, logger=<logging.Logger object>)¶Warn about the deprecation of a feature.
Parameters: |
|
---|
oslo_log.versionutils.
register_options
()¶Register configuration options used by this library.
oslo_log.versionutils.
report_deprecated_feature
(logger, msg, *args, **kwargs)¶Call this function when a deprecated feature is used.
If the system is configured for fatal deprecations then the message
is logged at the ‘critical’ level and DeprecatedConfig
will
be raised.
Otherwise, the message will be logged (once) at the ‘warn’ level.
Raises: | DeprecatedConfig if the system is configured for
fatal deprecations. |
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.