\r
`{"ts":1551183682974,"crit":"INFO","id":"myprog","mdc":{"second key":"other value","mykey":"keyval"},"msg":"hello world!"}`\r
\r
+ `{"ts":1602081593063,"crit":"INFO","id":"myapp","mdc":{"PID":"21587","POD_NAME":"tta-app-5565fc4d6f-ppfl8","CONTAINER_NAME":"tta-app","SERVICE_NAME":"TEST_APP","HOST_NAME":"master-an","SYSTEM_NAME":"CloudSpace-0"},"msg":"This is an example log"}`\r
+\r
Example\r
-------\r
\r
)\r
\r
func main() {\r
+ logFileMonitor := 0;\r
logger, _ := mdcloggo.InitLogger("myname")\r
+ if(logger.Mdclog_format_initialize(logFileMonitor)!=0) {\r
+ logger.Error("UnSuccessful Format Initialize")\r
+ }\r
logger.MdcAdd("mykey", "keyval")\r
logger.Info("Some test logs")\r
} \r
.. code:: bash\r
\r
func (l *MdcLogger) MdcClean()\r
+\r
+7. Mdclog_format_initialize Adds the MDC log format with HostName, PodName, ContainerName, ServiceName,PID,CallbackNotifyforLogFieldChange\r
+\r
+.. code:: bash\r
+\r
+ func (l *MdcLogger) Mdclog_format_initialize(log_change_monitor int) (int)\r
+\r
+Description: This api Initialzes mdclog print format using MDC Array 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.\r
+\r
+ Note: In K8s/Docker Containers the environment variables are declared in the Helm charts.\r
+\r
+ Refer xAPP developer guide for more information about how to define Helm chart.\r