mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
iris run main.go - prints the iris' logger but doesn't prints the banner everytime
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package iris
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
@@ -78,6 +79,14 @@ 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
|
||||
@@ -161,7 +170,9 @@ 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 {
|
||||
if s.Config.DisableBanner || SkipBannerFlag {
|
||||
// skip the banner
|
||||
} else {
|
||||
s.Logger.PrintBanner(banner,
|
||||
fmt.Sprintf("%s: Running at %s\n", time.Now().Format(config.TimeFormat),
|
||||
s.HTTPServer.Host()))
|
||||
|
||||
Reference in New Issue
Block a user