You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/howto.rst
+28-25Lines changed: 28 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1169,7 +1169,10 @@ If you use a Python-based configuration file, you can define your custom launche
1169
1169
Implementing a custom log handler
1170
1170
---------------------------------
1171
1171
1172
-
Here's an example implementation of a custom log handler defined in a Python-based configuration file.
1172
+
.. versionadded:: 4.7
1173
+
1174
+
ReFrame allows you to define custom log handlers and attach them to the framework.
1175
+
Here's an example implementation of a custom log handler and how it can be used in a Python-based configuration file.
1173
1176
1174
1177
Define a custom log handler class based on :class:`~logging.Handler` which uses a custom logging API:
1175
1178
@@ -1179,43 +1182,43 @@ Define a custom log handler class based on :class:`~logging.Handler` which uses
1179
1182
import mylogger
1180
1183
1181
1184
classMyLoggerHandler(logging.Handler):
1182
-
def__init__(self, key):
1183
-
super().__init__()
1184
-
self.key = key
1185
+
def__init__(self, key):
1186
+
super().__init__()
1187
+
self.key = key
1185
1188
1186
-
defemit(self, record):
1187
-
myrecord = {
1188
-
'value': record.check_perf_value,
1189
-
}
1190
-
mylogger.log(self.key, myrecord)
1189
+
defemit(self, record):
1190
+
myrecord = {
1191
+
'value': record.check_perf_value,
1192
+
}
1193
+
mylogger.log(self.key, myrecord)
1191
1194
1192
-
Apply the :func:`~reframe.core.logging.register_log_handler` decorator to a function returns an instance of the custom log handler:
1195
+
Applying the :func:`@register_log_handler <reframe.core.logging.register_log_handler>` decorator to a function returns an instance of the custom log handler:
1193
1196
1194
1197
.. code-block:: python
1195
1198
1196
1199
from reframe.core.logging import register_log_handler
0 commit comments