forked from Mirror/pmbootstrap
helpers: logging: add warn_once() (MR 2344)
Add a warn_once() function using Cache. Since we use f-strings everywhere we don't really need the varargs. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
a57b338e9e
commit
55c912d410
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,7 @@ from pathlib import Path
|
|||
import sys
|
||||
from typing import TextIO
|
||||
import pmb.config
|
||||
from pmb.meta import Cache
|
||||
|
||||
logfd: TextIO
|
||||
|
||||
|
@ -177,6 +178,10 @@ def warning(msg: object, *args, **kwargs):
|
|||
logging.warning(msg, *args, **kwargs)
|
||||
|
||||
|
||||
@Cache("msg")
|
||||
def warn_once(msg: str):
|
||||
logging.warning(msg)
|
||||
|
||||
def info(msg: object, *args, **kwargs):
|
||||
logging.info(msg, *args, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue