Skip to content

Commit 0f0fcb1

Browse files
pop_log_messages, get_log_messages for components
1 parent 640c71c commit 0f0fcb1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

hwcomponents/model.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from numbers import Number
44
from functools import wraps
55
from typing import Any, Callable, List, Type, Union, TypeVar
6-
from hwcomponents._logging import ListLoggable, pop_all_messages
6+
from hwcomponents._logging import ListLoggable, messages_from_logger, pop_all_messages
77
from hwcomponents._util import parse_float
88

99
T = TypeVar("T", bound="ComponentModel")
@@ -578,3 +578,25 @@ def resolve_multiple_ways_to_calculate_value(
578578
)
579579

580580
return next(iter(values))
581+
582+
def get_log_messages(self) -> List[str]:
583+
"""
584+
Returns the log messages for the component.
585+
586+
Returns
587+
-------
588+
List[str]
589+
The log messages for the component.
590+
"""
591+
return messages_from_logger(self.logger)
592+
593+
def pop_log_messages(self) -> List[str]:
594+
"""
595+
Pops the log messages for the component.
596+
597+
Returns
598+
-------
599+
List[str]
600+
The log messages for the component.
601+
"""
602+
return pop_all_messages(self.logger)

0 commit comments

Comments
 (0)