Logging Support is being added to hs-opentelemetry. Logging spec
Small (This PR) Context
LogRecords should be modifiable after creation for the purposes of LogRecordProcessors. This PR refactors LogRecord to contain a mutable IORef to an ImmutableLogRecord. It also adds convenience functions for adding attributes to LogRecords and a test suite that tests LoggerProviders and LogRecords.
LogRecords can only be read through the functions of ReadableLogRecord and modified by the functions of ReadWriteLogRecord. This is in accordance with the spec.
The type of the body field was changed from a type variable to an AnyValue so that processors and exporters can process logs from various sources that might have different body types.
Testing
stack build runs
New test suite under stack test hs-opentelemetry passes
Big Context
Logging Support is being added to hs-opentelemetry. Logging spec
Small (This PR) Context
LogRecord
s should be modifiable after creation for the purposes ofLogRecordProcessor
s. This PR refactorsLogRecord
to contain a mutableIORef
to anImmutableLogRecord
. It also adds convenience functions for adding attributes toLogRecord
s and a test suite that testsLoggerProvider
s andLogRecord
s.LogRecord
s can only be read through the functions ofReadableLogRecord
and modified by the functions ofReadWriteLogRecord
. This is in accordance with the spec.The type of the
body
field was changed from a type variable to anAnyValue
so that processors and exporters can process logs from various sources that might have different body types.Testing
stack build
runsstack test hs-opentelemetry
passes