{"@context":"https://w3id.org/codemeta/3.0","@type":"SoftwareSourceCode","identifier":"pkg:nuget/log.assert","name":"log.assert","description":"Log.Assert and Serilog.Assert add assertion-style application logging to ILogger.\n```\nlog.Me();\nlog.PreconditionNotNull(target);\n\nvar graphemes = new StringInfo(target??\"\");\nlog.Assert(graphemes.LengthInTextElements \u003e 0);\n\nlog.Precondition(0 \u003c= guess \u0026\u0026 guess \u003c= graphemes.LengthInTextElements);\n\nlog.ExceptionAndThrowIf(\n    graphemes.SubstringByTextElements(guess,1) is \"💥\",\n    new ApplicationException(\"bang!\"));\n\nvar remainder = Remove(graphemes,guess);\nlog.DebugIf(remainder.Length == 0,usefulState: \"TBC:is this permitted?\");\nlog.If(graphemes.LengthInTextElements \u003e 0,\n          usefulState: (target,guess,graphemes.LengthInTextElements),\n          label: \"Remaining after Removal\");\n\nlog.PreconditionNotNull(target);\nlog.Postcondition(remainder.Length \u003c target.Length);\nlog.Me(remainder);\nreturn remainder;\n```\n## What is Logged?\n \n- All methods log the current method or member name.\n- Assertions, Pre-, and Post-Conditions log nothing at all if they pass.\n- Assertions, Pre-, and Post-Conditions log the literal failed expression if they fail.\n- log.If() logs nothing at all if the condition is false\n- log.If() logs the literal condition expression if it is true\n- All methods can log additional information, either auto-labelled or explicitly labelled.\n\n```\nlog.Me()\n\nlog.Assert()\nlog.AssertNotNull()\nlog.Precondition()\nlog.PreconditionNotNull()\nlog.Postcondition()\nlog.PostconditionNotNull()\n\nlog.AssertElseThrow()\nlog.AssertNotNullElseThrow()\nlog.PreconditionElseThrow()\nlog.PreconditionNotNullElseThrow()\nlog.PostconditionElseThrow()\nlog.PostconditionNotNullElseThrow()\n\nlog.If()\nlog.IfNot()\n```\nand\n\n```\nlog.InformationIf()\nlog.TraceIf()\nlog.DebugIf()\nlog.WarnIf()\nlog.ErrorIf()\nlog.CriticalIf()\n\nlog.InformationIfNot()\nlog.TraceIfNot()\nlog.DebugIfNot()\nlog.WarnIfNot()\nlog.ErrorIfNot()\nlog.CriticalIfNot()\nlog.ExceptionIf()\nlog.ExceptionAndThrowIf()\nlog.Exception()\nlog.ExceptionAndThrow()\nlog.CriticalThenThrow()\nlog.CriticalExceptionThenExitProcessWithCode()\n```","version":"0.3.0-pre1","softwareVersion":"0.3.0-pre1","license":"https://spdx.org/licenses/LGPL-2.1-or-later","codeRepository":"https://github.com/chrisfcarroll/Log.Assert","url":"https://github.com/chrisfcarroll/Log.Assert","keywords":["logging","monitoring","assertions","debug","CallerArgumentExpression","Serilog","Microsoft.Extensions.Logging"],"dateCreated":"2026-05-21","dateModified":"2026-05-25","datePublished":"2026-05-25","copyrightYear":2026,"downloadUrl":"https://api.nuget.org/v3-flatcontainer/log.assert/0.3.0-pre1/log.assert.0.3.0-pre1.nupkg","applicationCategory":"nuget","runtimePlatform":"nuget","sameAs":["https://www.nuget.org/packages/log.assert/"]}