From b454ad295eb3024a238d32bf2aef1ebc3c496b44 Mon Sep 17 00:00:00 2001 From: Scott Date: Tue, 11 Jan 2022 13:33:24 -0800 Subject: Start using warnings from stdlib. --- persistent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'persistent.py') diff --git a/persistent.py b/persistent.py index f6ca0a0..2751572 100644 --- a/persistent.py +++ b/persistent.py @@ -7,6 +7,7 @@ import enum import functools import logging from typing import Any +import warnings import file_utils @@ -143,7 +144,9 @@ class persistent_autoloaded_singleton(object): logger.debug(f'Attempting to load {cls.__name__} from persisted state.') self.instance = cls.load() if not self.instance: - logger.warning('Loading from cache failed.') + msg = 'Loading from cache failed.' + logger.warning(msg) + warnings.warn(msg) logger.debug(f'Attempting to instantiate {cls.__name__} directly.') self.instance = cls(*args, **kwargs) else: -- cgit v1.3