@@ -64,7 +64,7 @@ func serverInit() {
64
64
case string :
65
65
return fmt .Errorf ("MAIN > Panic: %s" , e )
66
66
case error :
67
- return fmt .Errorf ("MAIN > Panic caused by: %w " , e )
67
+ return fmt .Errorf ("MAIN > Panic caused by: %s " , e . Error () )
68
68
}
69
69
70
70
return errors .New ("MAIN > Internal server error (panic)" )
@@ -268,7 +268,7 @@ func serverStart() {
268
268
// Start http or https server
269
269
listener , err := net .Listen ("tcp" , config .Keys .Addr )
270
270
if err != nil {
271
- log .Fatalf ( "starting http listener failed: %v " , err )
271
+ log .Abortf ( "Server Start: Starting http listener on '%s' failed. \n Error : %s \n " , config . Keys . Addr , err . Error () )
272
272
}
273
273
274
274
if ! strings .HasSuffix (config .Keys .Addr , ":80" ) && config .Keys .RedirectHttpTo != "" {
@@ -281,7 +281,7 @@ func serverStart() {
281
281
cert , err := tls .LoadX509KeyPair (
282
282
config .Keys .HttpsCertFile , config .Keys .HttpsKeyFile )
283
283
if err != nil {
284
- log .Fatalf ( "loading X509 keypair failed: %v " , err )
284
+ log .Abortf ( "Server Start: Loading X509 keypair failed. Check options 'https-cert-file' and 'https-key-file' in 'config.json'. \n Error : %s \n " , err . Error () )
285
285
}
286
286
listener = tls .NewListener (listener , & tls.Config {
287
287
Certificates : []tls.Certificate {cert },
@@ -292,20 +292,20 @@ func serverStart() {
292
292
MinVersion : tls .VersionTLS12 ,
293
293
PreferServerCipherSuites : true ,
294
294
})
295
- fmt .Printf ("HTTPS server listening at %s..." , config .Keys .Addr )
295
+ log .Printf ("HTTPS server listening at %s...\n " , config .Keys .Addr )
296
296
} else {
297
- fmt .Printf ("HTTP server listening at %s..." , config .Keys .Addr )
297
+ log .Printf ("HTTP server listening at %s...\n " , config .Keys .Addr )
298
298
}
299
299
//
300
300
// Because this program will want to bind to a privileged port (like 80), the listener must
301
301
// be established first, then the user can be changed, and after that,
302
302
// the actual http server can be started.
303
303
if err := runtimeEnv .DropPrivileges (config .Keys .Group , config .Keys .User ); err != nil {
304
- log .Fatalf ( "error while preparing server start: %s" , err .Error ())
304
+ log .Abortf ( "Server Start: Error while preparing server start. \n Error : %s\n " , err .Error ())
305
305
}
306
306
307
307
if err = server .Serve (listener ); err != nil && err != http .ErrServerClosed {
308
- log .Fatalf ( "starting server failed: %v " , err )
308
+ log .Abortf ( "Server Start: Starting server failed. \n Error : %s \n " , err . Error () )
309
309
}
310
310
}
311
311
0 commit comments