Skip to content

Commit 762f3c4

Browse files
committed
deprecate aliases to constants of logging stdlib
1 parent a96bbce commit 762f3c4

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

picamera2/picamera2.py

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,63 @@ class Picamera2:
148148
"""Welcome to the PiCamera2 class."""
149149

150150
platform = Platform.get_platform()
151-
152-
DEBUG = logging.DEBUG
153-
INFO = logging.INFO
154-
WARNING = logging.WARNING
155-
ERROR = logging.ERROR
156-
CRITICAL = logging.CRITICAL
157151
_cm = CameraManager()
158152

153+
@property
154+
def DEBUG(self):
155+
"""Now Deprecated
156+
157+
Use:
158+
> import logging
159+
> logging.DEBUG
160+
"""
161+
_log.error("DEBUG is deprecated. Returning `import logging; logging.DEBUG` instead")
162+
return logging.DEBUG
163+
164+
@property
165+
def INFO(self):
166+
"""Now Deprecated
167+
168+
Use:
169+
> import logging
170+
> logging.INFO
171+
"""
172+
_log.error("INFO is deprecated. Returning `import logging; logging.INFO` instead")
173+
return logging.INFO
174+
175+
@property
176+
def WARNING(self):
177+
"""Now Deprecated
178+
179+
Use:
180+
> import logging
181+
> logging.WARNING
182+
"""
183+
_log.error("WARNING is deprecated. Returning `import logging; logging.WARNING` instead")
184+
return logging.WARNING
185+
186+
@property
187+
def ERROR(self):
188+
"""Now Deprecated
189+
190+
Use:
191+
> import logging
192+
> logging.ERROR
193+
"""
194+
_log.error("ERROR is deprecated. Returning `import logging; logging.ERROR` instead")
195+
return logging.ERROR
196+
197+
@property
198+
def CRITICAL(self):
199+
"""Now Deprecated
200+
201+
Use:
202+
> import logging
203+
> logging.CRITICAL
204+
"""
205+
_log.error("CRITICAL is deprecated. Returning `import logging; logging.CRITICAL` instead")
206+
return logging.CRITICAL
207+
159208
@staticmethod
160209
def set_logging(level=logging.WARN, output=sys.stderr, msg=None) -> None:
161210
"""Configure logging for simple standalone use cases.

0 commit comments

Comments
 (0)