Git Product home page Git Product logo

Comments (6)

SDchao avatar SDchao commented on May 17, 2024

message.py:78

    elif event.type == "meta_event":
        log_msg += f"MetaEvent {event.raw_event}"
    logger.opt(colors=True).info(log_msg)

希望可以将元事件进行隐藏

from nonebot2.

SDchao avatar SDchao commented on May 17, 2024

希望也可以隐藏以下信息

logger.debug(f"Checking for matchers in priority {priority}...")
results = await asyncio.gather(*pending_tasks, return_exceptions=True)

from nonebot2.

yanyongyu avatar yanyongyu commented on May 17, 2024
  1. 心跳包这个你可以在开发环境调整心跳间隔,例如30s一次
  2. 这个info信息后续可以做简略调整
  3. 由于是debug模式,所以为了方便用户定位响应事件的优先级,所以打印了这行日志

from nonebot2.

SDchao avatar SDchao commented on May 17, 2024

啊……
对于3,我是希望将心跳包的优先级DEBUG信息进行隐藏。个人认为心跳包之类的元事件应当由nonebot框架处理,不应该涉及插件操作,相关INFO信息也可以省略。
目前我对message.py进行了如下调整,至少对于我来说效果不错……

async def handle_event(bot: Bot, event: Event):
    log_msg = f"<m>{bot.type.upper()} </m>| {event.self_id} [{event.name}]: "
    show_log = True
    elif event.type == "meta_event":
        log_msg += f"MetaEvent {event.raw_event}"
        show_log = False
    if show_log:
        logger.opt(colors=True).info(log_msg)
 pending_tasks = [
            _run_matcher(matcher, bot, event, state.copy())
            for matcher in matchers[priority]
        ]
        if show_log:
            logger.debug(f"Checking for matchers in priority {priority}...")

from nonebot2.

mnixry avatar mnixry commented on May 17, 2024

@yanyongyu 或者还有一种办法,把部分日志挪到trace等级?

from nonebot2.

yanyongyu avatar yanyongyu commented on May 17, 2024

removed in dev

from nonebot2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.