aimclub / aimclub/GOLEM

[Bug]: obsolete custom message logging

未关闭
#282 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
73
派生
11
平均合并
8 小时 51 分钟
30 天内合并 PR
4

描述

## 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)
...
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。