diff --git a/docs/Logging.md b/docs/Logging.md index 66d09f0..46ea9f0 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -81,7 +81,28 @@ For example, the following CSS changes the background color of the Web Log page ``` Note that HomeSpan outputs the full content of the Web Log HTML, including whatever CSS you may have specified above, to the Serial Monitor whenever the Log Level is set to 1 or greater. Reviewing this output can be helpful when creating your own CSS. - + +### Adding User-Defined Data and/or Custom HTML + +Homespan provides a hook into the text used to generate the Web Log that you can extend to add your own data to the initial table as well as more generally add any custom HTML. + +To access this text, set a Web Log callback using `homeSpan.setWebLogCallback(void (*func)(String &htmlText))` where + + * *func* is a function of type *void* that takes a single argument of type *String*, and + * *htmlText* will be set by HomeSpan to a String reference containing all the HTML text that the Web Log has already generated to produce the initial table. + +To add your own data to the table, simply extend the String *htmlText* by adding as many `
Click Here to Access HomeSpan Repo
"; +} +``` + +To embed this custom HTML text in the Web Log, call `homeSpan.setWebLogCallback(extraWebData)` in your sketch. + +Note that *r* is being passed as a reference and already includes all the HTML text the Web Log has produced to set up the page and create the initial table. You should therefore *extend* this String using `+=`. Do not simple assign this variable to a new String with `=` or you will overwrite all the HTML already produced! ---