Removed a few more "at"s and fixed ERRORS.md

This commit is contained in:
Tracker-Friendly 2024-07-21 10:00:27 +01:00
parent 6ac1c27db5
commit 9a831a5a6f
2 changed files with 12 additions and 14 deletions

View File

@ -6,20 +6,18 @@ All Burger-based software uses a simple logging system that outputs to TTY. Log
A log entry looks something like this:
| DATE | HUMAN-READABLE TIME | LOGLEVEL | DESCRIPTION | UNIX TIME* |
| DATE | HUMAN-READABLE TIME | LOGLEVEL | DESCRIPTION |
|---|---|---|---|---|
| 1969/12/31 | 11:59:59 | [INFO] | Added a new user at | 0000000000 |
*Unix time is only supplied once the server starts. The "Welcome" log that is outputted at the beginning of the program does not contain a timestamp (E.G `1970/12/31 00:00:00 [INFO] Welcome to Burgernotes! Today we are running on IP 0.0.0.0 on port 8080.`)
| 1969/12/31 | 11:59:59 | [INFO] | Added a new user |
## Log levels
There are 5 different log levels, with differing amounts of urgency
| INFO | WARN | ERROR | CRITICAL | FATAL | PROMPT |
|---|---|---|---|---|---|
| Usually harmless infomation, like a user being created | A warning about bad practices being used, such as having an unset config option | An error that disrupts user experience and may lead to undesired client-side behaviour | An error that affects all users on the platform | An error critical enough to warrent crashing the server process, usually something like the server being unable to bind to an IP or not being able to create the database | Anything that asks the user for input, like a confirmation dialog (typically has no timestamp) |
| INFO | WARN | ERROR | CRITICAL | FATAL | PROMPT |
|---------------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|-------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
| Usually harmless information, like a user being created | A warning about bad practices being used, such as having an unset config option | An error that disrupts user experience and may lead to undesired client-side behaviour | An error that affects all users on the platform | An error critical enough to warrant crashing the server process, usually something like the server being unable to bind to an IP or not being able to create the database | Anything that asks the user for input, like a confirmation dialog (typically has no timestamp) |
## Error reporting
Clients will be given 500 status code and an error code if any errors were to affect them. They are told to come to this page for more infomation. If you are one such client, please go to the issues tab and paste the error code along with some context, so we can fix the bug.
Clients will be given 500 status code and an error code if any errors were to affect them. They are told to come to this page for more information. If you are one such client, please go to the issues tab and paste the error code along with some context, so we can fix the bug.

12
main.go
View File

@ -238,7 +238,7 @@ func migrateDb() {
func main() {
if _, err := os.Stat("config.ini"); err == nil {
log.Println("[INFO] Config loaded at", time.Now().Unix())
log.Println("[INFO] Config loaded")
} else if os.IsNotExist(err) {
log.Fatalln("[FATAL] config.ini does not exist")
} else {
@ -446,10 +446,10 @@ func main() {
return
}
log.Println("[INFO] Added new user at", time.Now().Unix())
log.Println("[INFO] Added new user")
userid, taken, err := checkUsernameTaken(username)
if !taken {
log.Println("[CRITICAL] Something is very wrong! A user was created but could not be found in the database at", time.Now().Unix())
log.Println("[CRITICAL] Something is very wrong! A user was created but could not be found in the database")
log.Println("[INFO] This should not be possible. Please report this bug at https://centrifuge.hectabit.org/hectabit/burgernotes with the error code: UNKNOWN-API-SIGNUP-POSTTAKEN")
c.JSON(500, gin.H{"error": "Something went wrong on our end. Please report this bug at https://centrifuge.hectabit.org/hectabit/burgernotes and refer to the documentation for more info. Your error code is: UNKNOWN-API-SIGNUP-POSTTAKEN"})
return
@ -1448,16 +1448,16 @@ func main() {
if err != nil {
log.Println("[ERROR] Unknown in spent cleanup RowsAffected():", err)
} else {
log.Println("[INFO] Spent cleanup complete, deleted "+strconv.FormatInt(affectedRows, 10)+" rows at", time.Now().Unix())
log.Println("[INFO] Spent cleanup complete, deleted " + strconv.FormatInt(affectedRows, 10) + " rows")
}
}
}
}()
log.Println("[INFO] Server started at", time.Now().Unix())
log.Println("[INFO] Server started")
log.Println("[INFO] Welcome to Burgernotes! Today we are running on IP " + host + " on port " + strconv.Itoa(port) + ".")
err = router.Run(host + ":" + strconv.Itoa(port))
if err != nil {
log.Fatalln("[FATAL] Server failed to begin operations at", time.Now().Unix(), err)
log.Fatalln("[FATAL] Server failed to begin operations")
}
}