From f51b02643e996852584e70bcdc066520a58a3d08 Mon Sep 17 00:00:00 2001 From: Veniamin Malefioudakis Date: Mon, 5 Aug 2024 11:21:13 +0300 Subject: [PATCH] update docs --- docs/extending.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/extending.md b/docs/extending.md index 0948ddb2f..a9cd965bb 100644 --- a/docs/extending.md +++ b/docs/extending.md @@ -137,6 +137,15 @@ bash ### Use loggers instead of print We use the native `logging` [library](https://docs.python.org/3/library/logging.html) for logs management. This gets automatically configured when GaNDLF gets launched. So, if you are extending the code, please use loggers instead of prints. +Here is an example how `root logger` can be used +``` +def my_new_cool_function(df: pd.DataFrame): + logging.debug("Message for debug file only") + logging.info("Hi GaNDLF user, I greet you in the CLI output") + logging.error(f"A detailed message about any error if needed. Exception: {str(e)}, params: {params}, df shape: {df.shape}") + # print("Hi GaNDLF user!") # don't use prints please. +``` + Here is an example how logger can be used: ``` @@ -148,6 +157,7 @@ def my_new_cool_function(df: pd.DataFrame): # print("Hi GaNDLF user!") # don't use prints please. ``` + ### What and where is logged GaNDLF logs are splitted into multiple parts: