The following compiles
with Util.Log.Loggers;
package body LogTest is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create("./abc.log");
...
end LogTest;
The problem is that I need to read in the filename from a configuration file so I tried
package body LogTest is
Log: Util.Log.Loggers.Logger;
procedure LogTestInit(filename : String) is
begin
Log := Util.Log.Loggers.Create(filename);
end LogTestInit;
but it comes up with left hand side of assignment must not be limited type
. Two questions
I've since found that the string passed in
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create("./abc.log");
is not a filename but an identification tag, so it can be a hard coded constant, or, as @simonwright hinted, a function that returns a string. If there are multiple tasks or packages, each can have its own tag. The actual log filename is set in the configuration file that is passed to the Initialize
function.
For C# people, limited means it is not ICloneable.
For C++ people, limited means it is a non-copyable object.