Event Log Levels

A highly visible system needs to be able to quickly identify important information, whether by category, criticality, topic, or other means. Within the SightLane platform, we use Log Levels to help log designers (and readers) easily distinguish event content.  

EventLogger el = Logging.startLog('My Test Log');
try{
el.log('Welcome to the patient intake process');
el.log('First Name: Eric',Logging.INFO); // Using log Levels
el.reportToSightLane();
} catch (Exception ex){
el.log('An error has occurred!', Logging.ERROR); // Using log levels
el.reportFailureToSightLane(ex);
}

Adding log levels is as simple as adding a parameter to your log statements. The code above illustrates the basic use of SightLane log levels. It is also possible to apply a log level to a collection of statements, depending on your logging style.

List<String> logStatements = new List<String>();

EventLogger el = Logging.startLog('My Test Log');
logStatements.add('First Name: Eric');
logStatements.add('Last Name: Whipple');
el.log(logStatements, Logging.INFO); // log level applied to each log line
el.reportToSightLane();

Out of the box, SightLane supports traditional log level values.

  • DEBUG - Used to identify items of note for developers and support staff
  • INFO - A general indicator used to cause a single line to stand out
  • WARN - Indicates that a non-fatal error has occurred that may warrant attention
  • ERROR - Indicates that an error has occurred (whether or not that error is handled)

Their use is completely at the discretion of the log designer.  BUT WAIT... THERE'S MORE!

We don't want to limit designers to traditional log levels. Highlighting or filtering important log data may be needed for many reasons and across a variety of concerns. That is why we allow any string to be used as a logging level. The particular importance and relevance of log content should be up to the designer.

EventLogger el = Logging.startLog('My Test Log');
try{
el.log('Welcome to the patient intake process');
el.log('First Name: Eric','Inbound Lead Data'); // Using custom log Levels
el.log('Last Name: Whipple','Inbound Lead Data'); // Using custom log Levels
insert newLead;
el.log('Lead record updated', 'DML Statement');
 el.log('Intake process is complete');
el.reportToSightLane();
} catch (Exception ex){
el.log('An error has occurred!', Logging.ERROR); // Using log levels
el.reportFailureToSightLane(ex);
}

With these simple tools, you can design your own log levels, making it easier to highlight and find exactly what you're looking for within your processes.  this is especially helpful when logs are lengthy and looking for specific types of incidents within your logs needs to be done quickly.

Simply by adding appropriate logging levels to your SightLane logs, content will be easier to find and use in your response activities.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.