Skip to content

v1.7.0

Latest
Compare
Choose a tag to compare
@F1F88 F1F88 released this 19 Jan 12:18

Logger

Deprecated APIs

  • Removed async Logger feature (#21)

  • Removed BackTrace feature

    Logger.ShouldBacktrace
    Logger.EnableBacktrace
    Logger.DisableBacktrace
    Logger.DumpBacktrace
  • Removed constructor parameters sinks and numSinks (#24)

    Constructor is now mainly used to create an empty logger, to create with a list of sinks use Logger.CreateLoggerWith

    // v1.6.0
    public native Logger(const char[] name, Sink[] sinks, int numSinks);
    
    // v1.7.0
    public native Logger(const char[] name);
  • Migrate single Sink static factory method to Sink MethodMap

    // v1.6.0
    public static native Logger Logger.CreateBaseFileLogger()
    public static native Logger Logger.CreateDailyFileLogger()
    public static native Logger Logger.CreateRotatingFileLogger()
    public static native Logger Logger.CreateServerConsoleLogger()
    
    // v1.7.0
    public static native Logger BaseFileSink.CreateLogger()
    public static native Logger CallbackSink.CreateLogger()
    public static native Logger ClientChatAllSink.CreateLogger()
    public static native Logger ClientConsoleAllSink.CreateLogger()
    public static native Logger DailyFileSink.CreateLogger()
    public static native Logger RingBufferSink.CreateLogger()
    public static native Logger RotatingFileSink.CreateLogger()
    public static native Logger ServerConsoleSink.CreateLogger()

Improved APIs

  • Added Native Logger.CreateLoggerWith, Logger.CreateLoggerWithEx (#24)

  • Added Native Logger.AddSinkEx (#24)

Automatically release the parameter sink after adding sink successfully Handle

  • Added Native Logger.GetNameLength (#20)

  • Added Logger.ApplyAll optional data parameter (#18) (#20) (thanks @blueblur0730)

    // v1.6.0
    void ApplyAll(LoggerApplyAllCallback callback);
    
    // v1.7.0
    void ApplyAll(LoggerApplyAllCallback callback, any data = 0);
  • Added LoggerErrorHandler callback optional parameter (#24)

    // v1.6.0
    function void (const char[] msg);
    
    // v1.7.0
    function void (const char[] msg, const char[] name, const char[] file, int line, const char[] func);

Sink

  • Remove multithreading Sink (#21)

  • Remove MethodMap ClientChatSink, ClientConsoleSink (#21)

    For custom target requirements, please use CallbackSink

  • Added MethodMap ClientChatAllSink, ClientConsoleAllSink (#21)

  • Added MethodMap CallbackSink (#22) (#23)

  • Added MethodMap RingBufferSink (#25)

Chore
  • Added macro LOG4SP_GLOBAL_LOGGER_NAME

  • Added support for UTF8 encoding of logger names and file paths

  • New features LOG4SP_NO_EXT

    • Support outputting Off level logs

    • Support Logger.LogSrc and Logger.LogLoc

  • Fix a possible memory leak in Logger.ApplyAll

  • Fix incomplete log message of stack trace

  • Fix rare crash caused by underlying sink (#15) (#16)

  • Optimize operation efficiency (#24)

    • Logger.ApplyAll execution efficiency (slightly)

    • Logging operation execution efficiency (slightly)

    • Execution efficiency of non-output log level (significant)

    • Execution efficiency of base class sink Handle (significant)

  • Optimize compilation and build scripts (#17)

    • Compile and build efficiency

    • Generate binary file size

    • Migrate special macro definitions and tuning parameters to build scripts

    • Remove all modifications in "extern/spdlog"

    • Move test case files to testsuit folder

  • Unify project name "Log for SourcePawn"


Logger

弃用的 APIs

  • 移除异步 Logger 功能 (#21)

  • 移除回溯 (BackTrace) 功能

    Logger.ShouldBacktrace
    Logger.EnableBacktrace
    Logger.DisableBacktrace
    Logger.DumpBacktrace
  • 移除构造函数的参数 sinksnumSinks#24

    现在构造函数主要用于创建空 logger,要随 Sink 列表一起创建请使用 Logger.CreateLoggerWith

    // v1.6.0
    public native Logger(const char[] name, Sink[] sinks, int numSinks);
    
    // v1.7.0
    public native Logger(const char[] name);
  • 迁移单 Sink 的静态工厂方法到 Sink MethodMap

    // v1.6.0
    public static native Logger Logger.CreateBaseFileLogger()
    public static native Logger Logger.CreateDailyFileLogger()
    public static native Logger Logger.CreateRotatingFileLogger()
    public static native Logger Logger.CreateServerConsoleLogger()
    
    // v1.7.0
    public static native Logger BaseFileSink.CreateLogger()
    public static native Logger CallbackSink.CreateLogger()
    public static native Logger ClientChatAllSink.CreateLogger()
    public static native Logger ClientConsoleAllSink.CreateLogger()
    public static native Logger DailyFileSink.CreateLogger()
    public static native Logger RingBufferSink.CreateLogger()
    public static native Logger RotatingFileSink.CreateLogger()
    public static native Logger ServerConsoleSink.CreateLogger()

改进 APIs

  • 新增 Native Logger.CreateLoggerWith, Logger.CreateLoggerWithEx#24

  • 新增 Native Logger.AddSinkEx#24

    添加 sink 成功后会自动释放参数 sink Handle

  • 新增 Native Logger.GetNameLength (#20)

  • 新增 Logger.ApplyAll 可选 data 参数 (#18) (#20)(感谢 @blueblur0730

    // v1.6.0
    void ApplyAll(LoggerApplyAllCallback callback);
    
    // v1.7.0
    void ApplyAll(LoggerApplyAllCallback callback, any data = 0);
  • 新增 LoggerErrorHandler 回调可选参数(#24

    // v1.6.0
    function void (const char[] msg);
    
    // v1.7.0
    function void (const char[] msg, const char[] name, const char[] file, int line, const char[] func);

Sink

  • 移除多线程 Sink (#21)

  • 移除 MethodMap ClientChatSinkClientConsoleSink (#21)

    对于自定义目标的需求,请使用 CallbackSink

  • 新增 MethodMap ClientChatAllSinkClientConsoleAllSink (#21)

  • 新增 MethodMap CallbackSink (#22) (#23)

  • 新增 MethodMap RingBufferSink (#25)

杂项
  • 新增宏 LOG4SP_GLOBAL_LOGGER_NAME

  • 新增支持 UTF8 编码的 logger 名称和文件路径

  • 新增功能 LOG4SP_NO_EXT

    • 支持输出 Off 级别日志

    • 支持 Logger.LogSrc 和 Logger.LogLoc

  • 修复 Logger.ApplyAll 一处可能发生的内存泄漏

  • 修复堆栈跟踪的日志消息不完整

  • 修复罕见的因底层 Sink 引起的崩溃 (#15) (#16)

  • 优化运行效率(#24

    • Logger.ApplyAll 执行效率(小幅)

    • 记录日志操作执行效率(小幅)

    • 不输出的日志级别的执行效率(显著)

    • 基类 Sink Handle 的执行效率(显著)

  • 优化编译构建脚本 (#17)

    • 编译构建效率

    • 生成的二进制文件大小

    • 迁移专项宏定义和调优参数到构建脚本

    • 移除 "extern/spdlog" 里的所有修改

  • 移动测试用例文件到 testsuit 文件夹

  • 统一项目名称 "Log for SourcePawn"