[英]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? 我必须根据严重性过滤输出内容?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.