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
InterSystems IRIS Interoperability framework implements its own logging system. The Python API provides a way to use Python's logging module integrated with IRIS logging.
4
+
5
+
## Basic Usage
6
+
7
+
The logging system is available through the component base class. You can access it via the `logger` property or use the convenience methods:
8
+
9
+
```python
10
+
defon_init(self):
11
+
# Using convenience methods
12
+
self.log_info("Component initialized")
13
+
self.log_error("An error occurred")
14
+
self.log_warning("Warning message")
15
+
self.log_alert("Critical alert")
16
+
self.trace("Debug trace message")
17
+
18
+
# Using logger property
19
+
self.logger.info("Info via logger")
20
+
self.logger.error("Error via logger")
21
+
```
22
+
23
+
## Console Logging
24
+
25
+
You can direct logs to the console instead of IRIS in two ways:
26
+
27
+
1. Set the component-wide setting:
28
+
```python
29
+
defon_init(self):
30
+
self.log_to_console =True
31
+
self.log_info("This will go to console")
32
+
```
33
+
34
+
2. Per-message console logging:
35
+
```python
36
+
defon_message(self, request):
37
+
# Log specific message to console
38
+
self.log_info("Debug info", to_console=True)
39
+
40
+
# Other logs still go to IRIS
41
+
self.log_info("Production info")
42
+
```
43
+
44
+
## Log Levels
45
+
46
+
The following log levels are available:
47
+
48
+
-`trace()` - Debug level logging (maps to IRIS LogTrace)
49
+
-`log_info()` - Information messages (maps to IRIS LogInfo)
50
+
-`log_warning()` - Warning messages (maps to IRIS LogWarning)
51
+
-`log_error()` - Error messages (maps to IRIS LogError)
52
+
-`log_alert()` - Critical/Alert messages (maps to IRIS LogAlert)
53
+
-`log_assert()` - Assert messages (maps to IRIS LogAssert)
54
+
55
+
## Integration with IRIS
56
+
57
+
The Python logging is automatically mapped to the appropriate IRIS logging methods:
58
+
59
+
- Python `DEBUG` → IRIS `LogTrace`
60
+
- Python `INFO` → IRIS `LogInfo`
61
+
- Python `WARNING` → IRIS `LogWarning`
62
+
- Python `ERROR` → IRIS `LogError`
63
+
- Python `CRITICAL` → IRIS `LogAlert`
64
+
65
+
## Legacy Methods
66
+
67
+
The following methods are deprecated but maintained for backwards compatibility:
0 commit comments