<commit_before># Logging

To log info messages from within an [App](doc/app.md), [Model](doc/model.md) or [Controller](doc/controller.md) object:

```python
self.logger.info("information message")
```

To log warning messages:

```python
self.logger.warn("warning message")
```

To log error messages:

```python
self.logger.error("error message")
```

To log critical messages:

```python
self.logger.critical("critical message")
```

You can configure the logging level so that only messages at and above that level are logged
(to learn how to change app configurations read [Configuration](configuration.md)). If the
app is run with a logging level of `ERROR` and the following lines are executed:

```python
self.logger.info("info message")
self.logger.warn("warning message")
self.logger.error("error message")
self.logger.critical("critical message")
```

The output would be the following:

```bash
error message
critical message
```

The file path to where the log is written can be specified using `FILE_LOG` configuration variable:

```python
FILE_LOG=/var/log/hello.log python hello.py
```
<commit_msg>small improvement to logging guide<commit_after># Logging

To log info messages from within an [App](doc/app.md), [Model](doc/model.md) or [Controller](doc/controller.md) object:

```python
self.logger.info("information message")
```

To log warning messages:

```python
self.logger.warn("warning message")
```

To log error messages:

```python
self.logger.error("error message")
```

To log critical messages:

```python
self.logger.critical("critical message")
```

You can configure the logging level so that only messages at and above that level are logged
(to learn more read the [Configuration](configuration.md) guide):

```python
LEVEL=ERROR python hello.py
```

If the app is run with a logging level of `ERROR` and the following lines are executed:

```python
self.logger.info("info message")
self.logger.warn("warning message")
self.logger.error("error message")
self.logger.critical("critical message")
```

The output would be the following:

```bash
error message
critical message
```

The file path to where the log is written can be specified using `FILE_LOG` configuration variable:

```python
FILE_LOG=/var/log/hello.log python hello.py
```

{'fraction_non_alphanumeric': 0.1249450065992081, 'fraction_numerical': 0.0, 'mean_word_length': 5.4602272727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4842305', 'n_tokens_mistral': 676, 'n_tokens_neox': 628, 'n_words': 248}