Thank you, I love it.
I combined it with the recommendations from the Advanced Solution Engineering Concepts session about the use of extensions.
With this addition:
Imports System.Runtime.CompilerServices
Imports Newtonsoft.Json
...
Public Module LogHelper
<Extension()>
Public Sub LogObject(ByVal errorLogApi As IBRApiErrorLog, ByVal si As SessionInfo, ByVal message As String, objectToLog As Object)
Try
Dim objAsJsonString As String = JsonConvert.SerializeObject(objectToLog, Formatting.indented)
brapi.ErrorLog.LogMessage(si, message, objAsJsonString)
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Sub
End Module
You can call the logging like this
brapi.ErrorLog.LogObject(si, "Log Object", someObject)
It works really nicely, cheers