5.0.0
KonstantinRyazantsev
released this
24 Jun 23:14
·
58 commits
to master
since this release
Intro
Main objective of this release is redesign of the logging system. Starting from this release, logging system is built atop of Microsoft.Extensions.Logging. In this release old logging system still can be used, but all legacy methods are marked with Obsolete
attribute. This will give you a time to migrate to the new logging system, but obsolete API will be removed in futher releases.
Concerning new logging system, Lykke.Logs 5.0.0
contains all implementations of the new logging system. If you need only abstractions, you could reference just Lykke.Common 7.0.0
To learn about new logging system, read this.
Breaking changes
GeneratePartitionKey
method of theLogEntity
class has been made private.
Obsolete
These types are obsolete:
- Types to support custom Azure Table entities and they regular implementations have no replacement in the new logging system, the just will be removed. Instead of custom Azure Table log entities, you should use common log with additional properties as the context.
ILogEntityRowKeyGenerator<in TLogEntity>
LykkeLogToAzureEntityRowKeyGenerator
ILykkeLogToAzureStoragePersistenceManager
LykkeLogToAzureStoragePersistenceManager
ILogPersistenceManager<in TLogEntity>
LogPersistenceManager<TLogEntity>
- There is no direct replacement (and hopefully you don't need it) for the:
ILykkeLogToAzureSlackNotificationsManager
LykkeLogToAzureSlackNotificationsManager
LogEntity
class will be hidden, since this is implementation details.LogLevel
is replaced withMicrosoft.Extensions.Logging.LogLevel
LykkeLogToAzureBinder
will be replaced withLoggingServiceCollectionExtensions
LykkeLogToAzureStorage
there is no direct replacement for this class, it's just will be removed. Functionallity will be replaced by different components when you will useLoggingServiceCollectionExtensions
extension methodsLykkeLogToSlack
this class has no direct replacement, but it functionallity could be replaced withSlackLogBuilderExtensions
extension methods.
New features
LoggingServiceCollectionExtensions
class containsServiceCollection
extension methods which should be used by most of the app developers to initialize new logging system. Just callservices.AddLykkeLogging(...)
and injectILogFactory
whenever you need to log something.ILogBuilder
provides API to configure logging system during initialization.SlackLogBuilderExtensions
provides extension methods to configure Slack log.FilterLogBuilderExtensions
provides extension methods to configure logging system entries filtering.
- Logger options:
ConsoleLoggerOptions
configures console logger.AzureTableLoggerOptions
configures Azure Table logger.SlackLoggerOptions
configures essential Slack channels.AdditionalSlackLoggerOptions
configures additional Slack channels.
- Implementations of the
IHealthNotifier
HealthNotifier
default health notifier. Notifies about app health changing to the Monitoring Slack channel and info logging level. Most of the application developers will never create this class manually. It will be created automatically for you. Nevertheless, if you need to create it, useHealthNotifierSlackSenderFactory
.ConsoleHealthNotifier
notifies about app health changing to the console. Could be used in the tests. UseConsoleHealthNotifier.Instance
to obtain instance of the notifier.EmptyHealthNotifier
notifies about app health changing to the nowhere. Could be used in the tests. UseEmptyHealthNotifier.Instance
to obtain instance of the notifier.
- Implementations of the
ILogFactory
LogFactory
regular log factory. Writes logs according to the factory configuration. Most of the application developer will never create this class manually except tests. For tests, if you wish to trace logs to the console in the tests, then you could useLogFactory.Create().AddUnbufferedConsole()
to obtain factory instance.EmptyLogFactory
creates logs, that writes entries to the nowhere. Could be used in the tests. UseEmptyLogFactory.Instance
to obtain instance of the factory.
ISpamGuardConfiguration<in TLevel>
configures spam guard. Could be used by different loggers in their options.- These classes will not be used by most of the app developers and have been introduced for some special cases
IHealthNotifierSlackSenderFactory
andHealthNotifierSlackSenderFactory
factory ofHealthNotifier
ConsoleLogFactoryExtensions
Console log exntension methods to configureILogFactory
instance.AzureTableLogFactoryExtensions
Azure Table log extension methods to configureILogFactory
instance.SlackLogFactoryExtensions
Slack log extension methods to configureILogFactory
instance.
Improvements
Anti spam is disabled by default now for all overloads of LykkeLogToSlack.Create()