Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
benmalef committed Aug 5, 2024
1 parent 6488b39 commit f51b026
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
Expand All @@ -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:
Expand Down

0 comments on commit f51b026

Please sign in to comment.