Terminate on ERROR level
See original GitHub issueHi,
I’m looking to log different levels for my application such as INFO and ERROR.
When an ERROR is logged, I would like the application to terminate. Is there a way that loguru can handle this for me instead of checking the level manually and calling exit()
?
Many Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Exit - Terminate a script - Windows CMD - SS64.com
An errorlevel of -1073741510 will be interpreted by CMD.exe as a Ctrl-C Key sequence to cancel the current operation, not the entire script...
Read more >What are batch file exit codes or errorlevels? - ManageEngine
Use the command EXIT /B %ERRORLEVEL% at the end of the batch file to return the error codes from the batch file.
Read more >Control Error Level for cob Termination (-W err-level)
Causes cob processing to terminate after the COBOL Compiler err-level has been exceeded. By default, the cob command terminates if your code contains ......
Read more >Windows batch exit option b with or without errorlevel
If an environment variable named ERRORLEVEL is defined then %errorlevel% always resolves to its value (which can be arbitrary), and not to the ......
Read more >Common program exit codes and error levels - Febooti, Ltd.
Incorrect function. Indicates that Action has attempted to execute non-recognized command in Windows command prompt cmd.exe . Code 2. The ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Meh. I overlooked the
sink
accept amessage
string and not therecord
directly, so it must be slightly modified.You can also use two sinks: the first one will check the level and exit your application if needed. The other one will simply log the messages to your file unconditionally.
But you can also use the
filter
solution just as before, make sure to returnTrue
so logs are not discarded.Awesome! Thanks a lot @Delgan