|Events and logs|
PACKflow provides two contents to log history information.
Log entries will contain information about technical history and exceptions while events represent items' history.
Log entries can be accessed and created from PFSite, PFApplication and PFContentType objects using the PFRelation:
//Direct access PFApplication app; PFLogEntry entry = app.Logs.Add(); entry.Category = PFLogger_Category.Interface.ToString(); entry.Description = "Information message"; entry.Identification = CurrentItem.LogIdentification; entry.Level = PFLogger_Level.Information.ToString(); entry.User = CurrentUser.LoginName; entry.Trace = Environment.StackTrace; entry.Save();
But it can be much simpler to use the Logger object, available on all PACKflow objects:
//Use of the Logger object PFItem item; item.Logger.Error("Something went wrong", PFLogger_Category.Other);
It offers many other methods and overloads.
Events can be accessed and created from the Events relation on PFItem:
PFItem item; item.Events.Insert("New event", "Event description");
That method also allows to: