Releases: LykkeCity/CommonDotNetLibraries
7.0.0
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
andBeginScope
. - Precondition check of
maxCount
parameter in theGuiTableLastData
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 theProducerConsumer<T>
class. UseComponentName
property insted.Log
property ofProducerConsumer<T>
andTimerPeriod
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 replacesMonitor
level of legacy logging system. - New interface
ILogFactory
hidesMicrosoft.Extension.Ligging.ILoggerFactory
from application developer and according to the name, it createsILog
instances. This is one of the main abstraction in the new logging system. You should inject it in constructors of your classes insted ofILog
and createILog
instance right there, by calling one ofCreateLog
overload passingthis
as first argument. - New class
MicrosoftLoggingBasedLogExtensions
contains all ofILog
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 withCancellationToken
parameter has been added to theProducerConsumer<T>
class. - New interface
IProducerConsumerTrigger<T>
and its implementationProducerConsumerTrigger<T>
could be used instead ofProducerConsumer<T>
in "use by aggregate" instead of "use be inherit" way.- New delegate
ProducerConsumerConsumedEventHandler
has been added to handleIProducerConsumerTrigger<T>.Consumed
event. - New class
ProducerConsumerConsumedHandlerArgs<T>
has been added to pass event parameters to theProducerConsumerConsumedEventHandler
.
- New delegate
Bug fixes and improvements
Some minor bug fixes and improvements have been made.
6.8.6
6.8.5
6.8.4
6.8.3
6.8.2
6.8.1
6.8.0
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
6.6.0
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