An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

log.assert

Log.Assert and Serilog.Assert add assertion-style application logging to ILogger. ``` log.Me(); log.PreconditionNotNull(target); var graphemes = new StringInfo(target??""); log.Assert(graphemes.LengthInTextElements > 0); log.Precondition(0 <= guess && guess <= graphemes.LengthInTextElements); log.ExceptionAndThrowIf( graphemes.SubstringByTextElements(guess,1) is "💥", new ApplicationException("bang!")); var remainder = Remove(graphemes,guess); log.DebugIf(remainder.Length == 0,usefulState: "TBC:is this permitted?"); log.If(graphemes.LengthInTextElements > 0, usefulState: (target,guess,graphemes.LengthInTextElements), label: "Remaining after Removal"); log.PreconditionNotNull(target); log.Postcondition(remainder.Length < target.Length); log.Me(remainder); return remainder; ``` ## What is Logged? - All methods log the current method or member name. - Assertions, Pre-, and Post-Conditions log nothing at all if they pass. - Assertions, Pre-, and Post-Conditions log the literal failed expression if they fail. - log.If() logs nothing at all if the condition is false - log.If() logs the literal condition expression if it is true - All methods can log additional information, either auto-labelled or explicitly labelled. ``` log.Me() log.Assert() log.AssertNotNull() log.Precondition() log.PreconditionNotNull() log.Postcondition() log.PostconditionNotNull() log.AssertElseThrow() log.AssertNotNullElseThrow() log.PreconditionElseThrow() log.PreconditionNotNullElseThrow() log.PostconditionElseThrow() log.PostconditionNotNullElseThrow() log.If() log.IfNot() ``` and ``` log.InformationIf() log.TraceIf() log.DebugIf() log.WarnIf() log.ErrorIf() log.CriticalIf() log.InformationIfNot() log.TraceIfNot() log.DebugIfNot() log.WarnIfNot() log.ErrorIfNot() log.CriticalIfNot() log.ExceptionIf() log.ExceptionAndThrowIf() log.Exception() log.ExceptionAndThrow() log.CriticalThenThrow() log.CriticalExceptionThenExitProcessWithCode() ```

Ecosystem
nuget.org
Latest Release
0.3.0-pre1
1 day ago
Versions
3
Past Dependents
Include Past Dependents

Check this option to include packages that no longer depend on this package in their latest version but previously did.

Filter
Filter by Kind
Links
Registry nuget.org
Source Repository
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:nuget/log.assert
spec
License LGPL-2.1-or-later
First Release 5 days ago
Last Synced 1 day ago