examples: Rework policy DB example

Implicit log message source filtering has been dropped in favor of
explicit querying of the policy database.
This commit is contained in:
Adrian-Ken Rueegsegger 2014-10-14 22:56:14 +02:00
parent 6b9713578f
commit f1174ce1a0
1 changed files with 18 additions and 8 deletions

View File

@ -15,18 +15,28 @@ begin
-- This message will be logged because it matches a source specific
-- loglevel (Example.*).
Log.Log_Message (Source => "Example.Source1",
Level => Debug,
Msg => "This is a testmessage");
if Policy_DB.Accept_Src (Identifier => "Example.Source1",
Level => Debug)
then
Log.Log_Message (Source => "Example.Source1",
Level => Debug,
Msg => "This is a testmessage");
end if;
-- This message will not be logged because of the configured default 'Info'
-- loglevel. There's no configured source loglevel for 'Source2'.
Log.Log_Message (Source => "Source2",
Level => Debug,
Msg => "This will not be logged");
if Policy_DB.Accept_Src (Identifier => "Source2",
Level => Debug)
then
Log.Log_Message (Source => "Source2",
Level => Debug,
Msg => "This will not be logged");
end if;
-- No source specified, will not be logged because of the default 'Info'
-- loglevel.
Log.Log_Message (Level => Debug,
Msg => "This will not be logged");
if Policy_DB.Accept_Src (Level => Debug) then
Log.Log_Message (Level => Debug,
Msg => "This will not be logged");
end if;
end Policy_Example1;