Skip to content

5.0.0

Compare
Choose a tag to compare
@KonstantinRyazantsev KonstantinRyazantsev released this 24 Jun 23:14
· 58 commits to master since this release
c9805f2

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 the LogEntity 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 with Microsoft.Extensions.Logging.LogLevel
  • LykkeLogToAzureBinder will be replaced with LoggingServiceCollectionExtensions
  • 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 use LoggingServiceCollectionExtensions extension methods
  • LykkeLogToSlack this class has no direct replacement, but it functionallity could be replaced with SlackLogBuilderExtensions extension methods.

New features

  • LoggingServiceCollectionExtensions class contains ServiceCollection extension methods which should be used by most of the app developers to initialize new logging system. Just call services.AddLykkeLogging(...) and inject ILogFactory 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, use HealthNotifierSlackSenderFactory.
    • ConsoleHealthNotifier notifies about app health changing to the console. Could be used in the tests. Use ConsoleHealthNotifier.Instance to obtain instance of the notifier.
    • EmptyHealthNotifier notifies about app health changing to the nowhere. Could be used in the tests. Use EmptyHealthNotifier.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 use LogFactory.Create().AddUnbufferedConsole() to obtain factory instance.
    • EmptyLogFactory creates logs, that writes entries to the nowhere. Could be used in the tests. Use EmptyLogFactory.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 and HealthNotifierSlackSenderFactory factory of HealthNotifier
    • ConsoleLogFactoryExtensions Console log exntension methods to configure ILogFactory instance.
    • AzureTableLogFactoryExtensions Azure Table log extension methods to configure ILogFactory instance.
    • SlackLogFactoryExtensions Slack log extension methods to configure ILogFactory instance.

Improvements

Anti spam is disabled by default now for all overloads of LykkeLogToSlack.Create()