log.Fatal() | log.Panic() | |
---|---|---|
When to Use | When something unexpected happened | When something really unexpected happened |
Use Case | - Not enough arguments - can not access file - etc. | - Not having enough disk space - Not being find file that previously accessed - etc. |
Terminate Behavior | Stops the program at the point where log.Fatal() called |
Immediately stops the Go program |
Similar function | Similar to call log.Print() followed by os.Exit(1) |
Similar to call log.Print() followed by panic() |
Log Output | Prints out custom message only | Prints out the custom message and additional low level OS information |
Created
November 19, 2021 08:24
-
-
Save PetengDedet/ca336218c406b29bf69c04a0cbb731b2 to your computer and use it in GitHub Desktop.
log.Fatal vs log.Panic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment