Skip to content

Releases: LykkeCity/CommonDotNetLibraries

7.0.0

24 Jun 22:50
01fbd1c
Compare
Choose a tag to compare

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.

Considering new logging system, Lykke.Common 7.0.0 contains only abstractions and some generic implementations. Most implementation of the new logging system contained in the Lykke.Logs 5.0.0

To learn about new logging system, read this.

Breaking changes

Breaking changes are formal, likely they don't affect your code.

  • Three new methods have been added to the ILog interface - Log<TState>, IsEnabled and BeginScope.
  • Precondition check of maxCount parameter in the GuiTableLastData constructor has been added. maxCount Should be positive now.

Obsolete

All constructors and methods, which accepts ILog parameter are marked as obsolete. Overloads with ILogFactory insted of ILog have been added. Beside this, there are another things have been marked as obsolete:

  • _componentName field of the ProducerConsumer<T> class. Use ComponentName property insted.
  • Log property of ProducerConsumer<T> and TimerPeriod classes. Create and use your own log, don't use another's log.

New features

  • New interface IHealthNotifier represents abstraction, that notifies about application health changing. This replaces Monitor level of legacy logging system.
  • New interface ILogFactory hides Microsoft.Extension.Ligging.ILoggerFactory from application developer and according to the name, it creates ILog instances. This is one of the main abstraction in the new logging system. You should inject it in constructors of your classes insted of ILog and create ILog instance right there, by calling one of CreateLog overload passing this as first argument.
  • New class MicrosoftLoggingBasedLogExtensions contains all of ILog extension methods, which you will use to log something.
  • New class LogContextConversion incapsulates conversion of the log entry context to the string representation. Lykely you don't need to use it in your application code, used by the logging system itself.
  • New class LogEntryParameters incapsulates parameters of the log entry. Lykely you don't need to use it in your application code, used by the logging system itself.
  • New static class AppEnvironment could be used to obtain application name, version and ENV_INFO environment variable.
  • Overload of Consume method with CancellationToken parameter has been added to the ProducerConsumer<T> class.
  • New interface IProducerConsumerTrigger<T> and its implementation ProducerConsumerTrigger<T> could be used instead of ProducerConsumer<T> in "use by aggregate" instead of "use be inherit" way.
    • New delegate ProducerConsumerConsumedEventHandler has been added to handle IProducerConsumerTrigger<T>.Consumed event.
    • New class ProducerConsumerConsumedHandlerArgs<T> has been added to pass event parameters to the ProducerConsumerConsumedEventHandler.

Bug fixes and improvements

Some minor bug fixes and improvements have been made.

6.8.6

16 Jun 16:46
4c39f4d
Compare
Choose a tag to compare

Bug fixes

CountryManager

  • Check for null in HasIso3 method
  • Check for null in HasIso2 method
  • Check for null in Iso3ToIso2 method
  • Check for null in Iso2ToIso3 method
  • Check for null in GetCountryNameByIso3 method
  • Check for null in GetCountryNameByIso2 method

6.8.5

08 Jun 17:46
0a299af
Compare
Choose a tag to compare

Fixes

  • Check for null in IsValidPartitionOrRowKey method

6.8.4

30 May 20:00
f67fc52
Compare
Choose a tag to compare

Fixes

  • moved back Separator property of CsvWriter

6.8.3

30 May 15:14
98e8df0
Compare
Choose a tag to compare

Improvements

  • Improved IsPasswordComplex check policy

6.8.2

24 May 12:23
a51af7f
Compare
Choose a tag to compare
  • Fixed major sonarcube issues

6.8.1

18 May 12:40
9ee2cc9
Compare
Choose a tag to compare

BugFix

Fixed resources consumption calculation in ResourcesMonitor

6.8.0

18 May 08:53
a3d1be7
Compare
Choose a tag to compare

New features

ICountryNameResolver

ICountryNameResolver interface has been added. Use it as Autofac dependency type.
CountryNameResolver class has been added. Use it as implementation of ICountryNameResolver in Autofac.
It is responsible for resolving full country name by given Iso3 or Iso2 country code.
You could use string GetFullNameByCode(string code) method to get country name. Two code formats are supported:

  • Two capital letter code
  • Three capital letter code

Pay attention that code is case-sensitive, if you specify lower case code, or some invalid code, it will return empty string.

Examples

GetFullNameByCode("RUS"); // returns "Russia"
GetFullNameByCode("RU");  // returns "Russia"
GetFullNameByCode("NOR"); // returns "Norway"

GetFullNameByCode("nor"); // returns empty string
GetFullNameByCode("SomeCode"); // returns empty string

CountryManager

Added two methods for getting full country name by given Iso3 or Iso2 country code:

  • string GetCountryNameByIso3(string iso3)
  • string GetCountryNameByIso2(string iso2)

Improvements

CountryManager

CountryManager fields and methods now return IReadOnlyDictionary<string, string>instead of IReadOnlyDictionary<string, string>. Affected methods and fields:

  • CisCountry()
  • ChineseCountry()
  • DictCountryIso2ToIso3Links
  • CountryIso2ToIso3Links

6.7.0

10 May 07:36
4f9ce56
Compare
Choose a tag to compare

New Features

Added extension method SanitizeIp, to sanitize ipv4 address, i.e. 192.168.1.100 -> 192.168.1.0

6.6.0

01 May 19:35
e803364
Compare
Choose a tag to compare

Obsolete

TimerPeriod.SetLogger(ILog log) method has been obsolete. Pass log to the ctor.

New features

TimerTrigger

TimerTrigger class has been added. It's intended to do periodical work and do all necessary general stuff like logging of unhandled exceptions and App Insight telemetry gathering, just like TimerPeriod, but in contrast to TimerPeriod, you don't need to subclass it, instead you could aggregate it.

Timer event handler could be passed to the ctor of TimerTrigger, or you could subscribe to the Triggered event, both ways are equivalent..

You could call TimerTrigger.DisableTelemetry() to disable Application Insight telemetry.

TimerTrigger is implement ITimerTrigger, which in turn inherits IStartable and IStopable.

To start timer you should call Start() method. You could use Stop() to stop timer. Once timer is stopped, it could be started again. Dispose() stops timer as well.

CancellationToken is passed to the Triggered event handler, this token will be cancelled if some one wants to stop the timer. You could use it to abort long work, to make stopping of the timer more rapid.

Triggered event handler execution time is not included in the period of the timer. i.e. period of timer - is time between calls of the Triggered event handler.

Improvements

TimerPeriod code has been improved