Skip to content

Commit a149214

Browse files
committed
revert logger's branch change
1 parent ecd13f7 commit a149214

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

geos-mesh/src/geos/mesh/processing/FillPartialArrays.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from geos.mesh.utils.arrayModifiers import fillPartialAttributes
1010
from geos.mesh.utils.arrayHelpers import getAttributePieceInfo
1111

12-
from geos.utils.details import addLogSupport
1312
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
1413

1514
__doc__ = """
@@ -52,13 +51,13 @@
5251
loggerTitle: str = "Fill Partial Attribute"
5352

5453

55-
@addLogSupport( loggerTitle=loggerTitle )
5654
class FillPartialArrays:
5755

5856
def __init__(
5957
self: Self,
6058
multiBlockDataSet: vtkMultiBlockDataSet,
6159
dictAttributesValues: dict[ str, Union[ list[ Any ], None ] ],
60+
speHandler: bool = False,
6261
) -> None:
6362
"""Fill partial attributes with constant value per component.
6463
@@ -76,6 +75,29 @@ def __init__(
7675
self.multiBlockDataSet: vtkMultiBlockDataSet = multiBlockDataSet
7776
self.dictAttributesValues: dict[ str, Union[ list[ Any ], None ] ] = dictAttributesValues
7877

78+
# Logger.
79+
self.logger: Logger
80+
if not speHandler:
81+
self.logger = getLogger( loggerTitle, True )
82+
else:
83+
self.logger = logging.getLogger( loggerTitle )
84+
self.logger.setLevel( logging.INFO )
85+
86+
def setLoggerHandler( self: Self, handler: logging.Handler ) -> None:
87+
"""Set a specific handler for the filter logger.
88+
89+
In this filter 4 log levels are use, .info, .error, .warning and .critical, be sure to have at least the same 4 levels.
90+
91+
Args:
92+
handler (logging.Handler): The handler to add.
93+
"""
94+
if not self.logger.hasHandlers():
95+
self.logger.addHandler( handler )
96+
else:
97+
self.logger.warning(
98+
"The logger already has an handler, to use yours set the argument 'speHandler' to True during the filter initialization."
99+
)
100+
79101
def applyFilter( self: Self ) -> bool:
80102
"""Create a constant attribute per region in the mesh.
81103

0 commit comments

Comments
 (0)