Skip to content

acl 的日志回调能否提供日志等级信息 #369

@lymslive

Description

@lymslive

我们想将 acl 底层库的日志打印集成到上层业务服务的日志系统中,看到有个回调设计,就这么用了:

void LogHookForACL(void* ctx, const char* fmt, va_list ap)
{
    static char szbuffer[1024] = {0};
    vsnprintf(szbuffer, sizeof(szbuffer), fmt, ap);
    // acl redis 库基本只在出错时打印 logger_error
    LOG_ERROR(szbuffer);
}

void InitLogHookForACL()
{
    acl_msg_pre_write(LogHookForACL, nullptr);
}

这有个不足是回调中似乎没有提供日志等级信息,上层只能统一打印为 ERROR 级别的日志。

我看到 acl 源码中也有几种不同的写日志函数(宏),说明也是有日志等级概念的,那能否把这个日志等级信息传出来,让上层日志系统也能通过等级来控制。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions