Error log changes

This commit is contained in:
aunefyren 2022-12-11 17:39:53 +01:00
parent 8b5ace3fa7
commit 6a2fc08a0e
2 changed files with 8 additions and 15 deletions

21
main.go
View file

@ -24,22 +24,18 @@ func main() {
// Create and define file for logging
file, err := os.OpenFile("config/wrapperr.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
log.Println("Failed to load configuration file. Error: ")
log.Println(err)
log.Println("Failed to load configuration file. Error: " + err.Error())
fmt.Println("Failed to load configuration file. Error: ")
fmt.Println(err)
fmt.Println("Failed to load configuration file. Error: " + err.Error())
os.Exit(1)
}
config, err := files.GetConfig()
if err != nil {
log.Println("Failed to load configuration file. Error: ")
log.Println(err)
log.Println("Failed to load configuration file. Error: " + err.Error())
fmt.Println("Failed to load configuration file. Error: ")
fmt.Println(err)
fmt.Println("Failed to load configuration file. Error: " + err.Error())
os.Exit(1)
}
@ -48,19 +44,16 @@ func main() {
if config.Timezone != "" {
loc, err := time.LoadLocation(config.Timezone)
if err != nil {
fmt.Println("Failed to set time zone from config. Error: ")
fmt.Println(err)
fmt.Println("Failed to set time zone from config. Error: " + err.Error())
fmt.Println("Removing value...")
log.Println("Failed to set time zone from config. Error: ")
log.Println(err)
log.Println("Failed to set time zone from config. Error: " + err.Error())
log.Println("Removing value...")
config.Timezone = ""
err = files.SaveConfig(config)
if err != nil {
log.Println("Failed to set new time zone in the config. Error: ")
log.Println(err)
log.Println("Failed to set new time zone in the config. Error: " + err.Error())
log.Println("Exiting...")
os.Exit(1)
}

View file

@ -732,7 +732,7 @@ function set_wrapperr_settings() {
html += '</div>';
html += '<div class="form-group">';
html += '<label for="timezone" title="The timezone the data is located in, like \'Europe/Oslo\'. Type it exactly as it is specified in the PHP documentation.">Timezone: <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" target="_blank">(List)</a></label>';
html += '<label for="timezone" title="The timezone the data is located in, like \'Europe/Oslo\'. Type it exactly as it is specified in the IANA Time Zone database.">Timezone: <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" target="_blank">(List)</a></label>';
html += '<input type="text" class="form-control" id="timezone" value="' + timezone + '" autocomplete="off" placeholder="" required /><br>';
html += '</div>';