简体   繁体   English

如何在Ada库alog中设置Log_Level

[英]How to set the Log_Level in Ada library alog

I am using the library alog for the first time in a project. 我在项目中第一次使用库alog I have a problem understanding how to set the log level for all subsequent log commands. 我在理解如何为所有后续日志命令设置日志级别时遇到问题。

See my test program: 查看我的测试程序:

with Alog;                         use Alog;
with Alog.Logger;
with Alog.Policy_DB;               use Alog.Policy_DB;

procedure Test_Loglevel
is
   L : Logger.Instance (Init => True);

   procedure Act_And_Log
   is begin
      null;
      L.Log_Message (Alog.Debug, "very detailed, only for debugging");
      null;
      L.Log_Message (Alog.Info,  "some more detailed infos");
      null;
      L.Log_Message (Alog.Notice, "general messages for interactive use");
      null;
      L.Log_Message (Alog.Warning, "something serious happened");
      null;
      L.Log_Message (Alog.Error, "error messages should always be displayed");
   end Act_And_Log;

begin
   --
   -- all logs should be displayed
   --
   Set_Loglevel ("*", Debug);
   Set_Default_Loglevel (Debug);
   Act_And_Log;
   --
   -- only error
   --
   Set_Loglevel ("*", Error);
   Set_Default_Loglevel (Error);
   Act_And_Log;

end Test_Loglevel;

I would expect that all 5 messages are displayed the first time and only the error message is displayed the second time. 我希望第一次显示所有5条消息,而第二次仅显示错误消息。 The actual output, however, shows the 5 messages twice! 但是,实际输出两次显示5条消息!

What do I have to do to filter the output based on severity? 我必须根据严重性过滤输出内容?

I directly asked the authors of alog. 我直接问过alog的作者。 They responded with a patch . 他们回答了一个补丁 I still find the doc a bit misleading. 我仍然认为该文档有些误导。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据scrapy中的日志条目来源有选择地设置log_level? - How to selectively set log_level depending on origin of log entry in scrapy? 如何通过Maven项目的LOG_LEVEL过滤码头日志? - How to filter jetty logs by LOG_LEVEL of maven project? 即使将log_level设置为:debug,rails 4.2也无法在heroku日志中看到数据库查询 - rails 4.2 can't see db queries in heroku logs even though log_level set to :debug 是否可以在 GLib 新结构化日志记录中为每个域/日志级别设置不同的写入器函数? - Is it possible to set different writer functions per domain/log_level in GLib new structured logging? 除了Alog(http://www.nongnu.org/alog/)之外,还有针对Ada的日志框架或众所周知的设计模式吗? - Are there logging frameworks or well-known design patterns for Ada in addition to Alog (http://www.nongnu.org/alog/)? python日志记录模块中的log_level参数不会影响性能吗? - Doesn't log_level parameter in python logging module affect performance? 如何设置jmxtrans的日志级别 - How to set log level for jmxtrans OpenShift:如何设置JBoss AS的日志级别 - OpenShift: How to set the log-level of JBoss AS 如何单独设置Rails Cache日志级别? - How to set Rails Cache log level separately? 如何在glib中设置日志级别 - How can I set the log level in glib
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM