aimclub / aimclub/GOLEM

[Bug]: obsolete custom message logging

Open
#282 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
73
Forks
11
Avg merge
8h 51m
Merged PRs (30d)
4

Description

## Overview

When working with frameworks that rely both on `FEDOT` and `GOLEM`, one can encountered a problem when trying to log using the `message` method. The problem is that the incorrect logging level is set, which results in an error of `KeyError: 45`.

This issue has already been discussed. The no-brainer solution to this unexpected behavior is to replace the `level` value with one of the default levels (for example, `40`). Additionally, it might be appropriate to display a message that the `message` method is now outdated and doesn't differ from the `info` method.

https://github.com/aimclub/GOLEM/blob/c85a9d79ae47bcaa116c6c2a845a553b50dfaedb/golem/core/log.py#L165-L170

A listing of a rather ugly workaround mock in our test suite

```py
def mock_message(self, msg: str, **kwargs):
level = 40
self.log(level, msg, **kwargs)

@pytest.mark.parametrize('pipeline_case', LINEAR_PIPELINE_CASES, ids=str)
def test_valid_linear_pipelines(pipeline_case: LinearPipelineCase, monkeypatch):
# monkeypatch golem message function
monkeypatch.setattr(golem.core.log.LoggerAdapter, 'message', mock_message)
...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.