Difference: AssertationLogging (2 vs. 3)

Revision 32021-12-31 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
%DASHBOARD{ section="banner"
Line: 21 to 21
 

How to use

Changed:
<
<
fatalassert ( flag n -- ) abort if flag is false, log n after restart assert ( flag n -- ) abort if flag is false and assertion is activated, log n after restart
>
>
fatalassert ( flag n u -- ) abort if flag is false, log n and u after restart assert ( flag n u -- ) abort if flag is false and assertion is activated, log n and u after restart
 assert? ( -- flag ) Was there an assert? assert# ( -- u ) How many aseerts occured since cold startup?
Changed:
<
<
assert@ ( -- n ) Assert number .assert ( n -- ) Print assert message
>
>
assert@ ( -- n u ) Assert number and parameter e.g. address where the assert occured .assert ( n u -- ) Print assert message
 

If logging is activated the logs are written to

Line: 40 to 40
 /var/log/messages

https://en.wikipedia.org/wiki/Assertion_(software_development)

Changed:
<
<
>
>
 During development cycle, the programmer will typically run the program with assertions enabled. When an assertion failure occurs, the programmer is immediately notified of the problem. Many assertion implementations will also halt the program's execution: this is useful, since if the program continued to run after an assertion violation occurred, it might corrupt its state and make the cause of the problem more difficult to locate. Using the information provided by the assertion failure (such as the location of the failure and perhaps a stack trace, or even the full program state if the environment supports core dumps or if the program is running in a debugger), the programmer can usually fix the problem. Thus assertions provide a very powerful tool in debugging.

When a program is deployed to production, assertions are typically turned off, to avoid any overhead or side effects they may have.

Added:
>
>
 
Line: 55 to 56
 -- Peter Schmid - 2021-12-25

Creative Commons License
This work by Peter Schmid is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Added:
>
>
META TOPICMOVED by="PeterSchmid" date="1640946419" from="MecrispCube.AssertationAndLogging" to="MecrispCube.AssertationLogging"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback