An implementation of Vostok ILog that send events to Hercules. Also provides mapping from Hercules events back to Log Events.
Build guide: https://github.com/vostok/devtools/blob/master/library-dev-conventions/how-to-build-a-library.md
User documentation: https://vostok.gitbook.io/logging/
Here's how LogEvent instances are mapped into Hercules events (according to schema):
-
Timestamp
(mandatory) corresponds to:- Hercules event built-in timestamp —
UtcDateTime
ofTimestamp
. utcOffset
tag — along
tag with offset from UTC expressed in 100-ns ticks.
- Hercules event built-in timestamp —
-
Level
--->level
tag ofstring
type. -
MessageTemplate
--->messageTemplate
tag ofstring
type. -
RenderedMessage
--->message
tag containing rendered text. -
Properties
dictionary corresponds to a container with nameproperties
. This container contains a tag for each pair. Keys are translated as-is, and the values are handled according to following conventions:- If the value is a primitive scalar or a vector of primitive scalars natively supported by Hercules (such as
int
,long
,guid
,string
, etc), it's mapped as-is. - Otherwise the value gets converted to
string
: either stringified directly (if it properly overridesToString()
) or serialized to JSON. No further container-like structure is allowed, all values end up being 'flat'.
- If the value is a primitive scalar or a vector of primitive scalars natively supported by Hercules (such as
-
Exception
object corresponds to a container with nameexception
and following tags:- Exception runtime type (e.g.
System.NullReferenceException
) --->type
tag of typestring
. - Exception message --->
message
tag of typestring
. - Nested exceptions (e.g.
InnerException
andInnerExceptions
forAggregateException
) --->innerExceptions
tag of typeVector
which contains other exceptions in the same format. - Stacktrace of exception --->
stackFrames
tag of typeVector<StackFrame>
.StackFrame
is a container of following tags which describe a point of code which executed when the exception occured:function
- a name of function (method).type
- a type whenfunction
is declared.file
- file name.line
- line number.column
- column number.
- Exception runtime type (e.g.