Logging important control events

In distributed IoT control applications, it's vitally important to make sure unauthorized access to the system is avoided. While we will dive deeper into this subject in later chapters, one important tool we can start using is to log everything of security interest in the event log. We can decide what to do with the event log later, whether we want to analyze or store it locally, or distribute it in the network for analysis somewhere else. But unless we start logging events of security interest directly when we develop, we risk forgetting logging certain events later. So, let's log an event every time the output is set:

Log.Informational("Setting Control Parameter.", 
   string.Empty, Actor ?? "Windows user", 
   new KeyValuePair<string, object>("Output", On)); 

If the Actor parameter is null, we assume the control parameter has been set from the Windows GUI. We use this fact, to update the window, if the change has been requested from somewhere else:

if (Actor != null) 
   await MainPage.Instance.OutputSet(On); 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset