Skip to content

v1.4.0

Compare
Choose a tag to compare
@F1F88 F1F88 released this 09 Nov 02:31
· 225 commits to main since this release

New features

  • Added natives

    • Logger.LogStackTrace()

    • Logger.LogStackTraceAmxTpl()

    • Logger.ThrowError()

    • Logger.ThrowErrorAmxTpl()

  • Added macro definitions

    • LOG4SP_NO_LOG

      This feature is added because some developers do not want to rely on too many external components when releasing new plugins;

      If this macro is defined before the header file is introduced, most natives will be replaced with empty functions, and only a few natives that print logs will be replaced with sourcemod API;

      The compiled plugin will no longer rely on the log4sp extension, and key logs will also be recorded. (Info level and above, recorded by sourcemod API).

Changes

  • These natives are deprecated and are not recommended to be used anymore. And they may be removed in future versions.

    • Logger.AddSink()

    • Logger.DropSink()

      Tips: Use new Logger() instead

    • Removed default Logger configuration from starter config (only thread pool configuration left)

    • Optimized help documentation for console command sm log4sp

Fixes

  • Fixed memory leak when calling these natives

    • Logger.LogSrc()

    • Logger.LogSrcAmxTpl()

    • Sink.LogSrc()

    • Sink.LogSrcAmxTpl()

  • Now sets global client for translation to server default language before formatting log messages


新特性

  • 新增 natives

    • Logger.LogStackTrace()

    • Logger.LogStackTraceAmxTpl()

    • Logger.ThrowError()

    • Logger.ThrowErrorAmxTpl()

  • 新增宏定义

    • LOG4SP_NO_LOG

      考虑到有开发者发布新插件时不希望依赖过多的外部组件而添加了这个功能;

      如果在引入 头文件之前定义这个宏,大部分 natives 将被替换为空函数,仅少部分打印日志的 natives 使用 sourcemod API 替代;

      编译出来的插件就不再依赖 log4sp 拓展,并且关键的日志也会记录。(Info 级别及以上,由 sourcemod API 记录)。

变更

  • 这些 natives 已经过时,不推荐继续使用,并且可能在未来的版本移除

    • Logger.AddSink()

    • Logger.DropSink()

      Tips: 使用 new Logger() 替代

  • 移除了起步配置中默认 Logger 的配置项(目前仅剩线程池配置项)

  • 优化了控制台指令 sm log4sp 的帮助文档

修复

  • 修复了调用这些 natives 时产生的内存泄漏

    • Logger.LogSrc()

    • Logger.LogSrcAmxTpl()

    • Sink.LogSrc()

    • Sink.LogSrcAmxTpl()

  • 现在进行格式化日志消息前,会先将用于辅助翻译的全局客户端设为服务器默认语言