Mic-M / ioBroker.logparser

ioBroker Log Parser Adapter
MIT License
7 stars 2 forks source link

CSS classes for the whole log entry #16

Closed MojitoJoe1813 closed 3 years ago

MojitoJoe1813 commented 3 years ago

For me it was very important to style the whole log entry based on severity - not only the severity itself (bc maybe I do not even show that). That wasn't possible with CSS as you were styling only the severity and by an additional span-object not used in the other log-elements.

I added the following lines in your code and replaced line 512 in main.js - works fine for me:

logObjJson.severity = "<span class='log" + newLogObject.severity.charAt(0).toUpperCase() + newLogObject.severity.slice(1) + " lpSeverity'>" + newLogObject.severity + '</span>';
logObjJson.message = "<span class='log" + newLogObject.severity.charAt(0).toUpperCase() + newLogObject.severity.slice(1) + " lpMessage'>" + newLogObject.message + '</span>';
logObjJson.date = "<span class='log" + newLogObject.severity.charAt(0).toUpperCase() + newLogObject.severity.slice(1) + " lpDate'>" + newLogObject.date + '</span>';
logObjJson.from = "<span class='log" + newLogObject.severity.charAt(0).toUpperCase() + newLogObject.severity.slice(1) + " lpFrom'>" + newLogObject.from + '</span>';

That now allows me very flexible and easy to either just style none, one specific, some or all elements of the log-entry on the respective severity (even if the severity is not shown). I would suggest to use this or something similar to allow more flexibility in styling the log-results.

Mic-M commented 3 years ago

Thank you for your enhancement request. Great timing, since I was anyway about to update the adapter, so I have implemented your feature request as well. Adapter version 1.1.0:

image