1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 04:21:57 +00:00

iris run : Print the banner on every reload

This commit is contained in:
Makis Maropoulos
2016-06-25 07:38:47 +03:00
parent e4038efb96
commit 1b3803e5c2
3 changed files with 5 additions and 17 deletions

View File

@@ -1,7 +1,6 @@
package iris
import (
"flag"
"fmt"
"os"
"sync"
@@ -79,14 +78,6 @@ type Framework struct {
Websocket websocket.Server
}
// SkipBannerFlag, if enabled then means that this instance ran propably by an external software, which can disable the banner output by the command line argument '-s'
var SkipBannerFlag bool
func init() {
flag.BoolVar(&SkipBannerFlag, "s", false, "Disable banner via command line tool, overrides the logger's config field") // this mostly used by the iris command line tool
flag.Parse()
}
// New creates and returns a new Iris station aka Framework.
//
// Receives an optional config.Iris as parameter
@@ -170,9 +161,7 @@ func (s *Framework) openServer() (err error) {
s.HTTPServer.SetHandler(s.mux)
if err = s.HTTPServer.Open(); err == nil {
// print the banner
if s.Config.DisableBanner || SkipBannerFlag {
// skip the banner
} else {
if !s.Config.DisableBanner {
s.Logger.PrintBanner(banner,
fmt.Sprintf("%s: Running at %s\n", time.Now().Format(config.TimeFormat),
s.HTTPServer.Host()))