*Example log output*
-`{"ts": 1559285893047, "crit": "INFO", "id": "myprog", "mdc": {"second key":"other value","mykey":"keyval"}, "msg": "Hello world!"}`
+`{"ts": 1603103945651, "crit": "ERROR", "id": "test.py", "mdc": {"SYSTEM_NAME": "Cloud-Space", "HOST_NAME": "master", "SERVICE_NAME": "TestApp", "CONTAINER_NAME": "Container-101", "POD_NAME": "POD-101"}, "msg": "Hello World!"}`
Install
-------
```python
import mdclogpy
+ mdclogpy.mdclog_format_init(configmap_monitor=True)
mdclogpy.error("This is an error log")
```
```python
from mdclogpy import Logger
my_logger = Logger()
+ my_logger.mdclog_format_init(configmap_monitor=True)
my_logger.error("This is an error log")
```
A program can create several logger instances.
+mdclog_format_init() Adds the MDC log format with HostName, PodName, ContainerName, ServiceName,PID,CallbackNotifyforLogFieldChange
+
+Pass configmap_monitor = False in mdclog_format_init() function to stop dynamic log level change based on configmap.
+
Logging Levels
--------------
.. code:: bash
def clean_mdc(self):
+7. Initialise Sep Logging format:
+
+This api Initialzes mdclog print format using MDC Dictionary by extracting the environment variables in the calling process for “SYSTEM_NAME”, “HOST_NAME”, “SERVICE_NAME”, “CONTAINER_NAME”, “POD_NAME” & “CONFIG_MAP_NAME” mapped to HostName, ServiceName, ContainerName, Podname and Configuration-file-name of the services respectively.
+
+
+.. code:: bash
+
+ def mdclog_format_init(configmap_monitor=False):
+
+ Keyword arguments:
+ configmap_monitor -- Enables/Disables Dynamic log level change based on configmap
+ -- Boolean values True/False can be passed as per requirement.
+
+
+
License
-------