diff options
author | 2019-08-30 15:12:17 +0100 | |
---|---|---|
committer | 2019-08-30 15:12:17 +0100 | |
commit | c466003a943fac7dd78b25b672922a1a0944b59a (patch) | |
tree | eb7230c7bd2f2b9d7d970e2b85c8d05b69499741 | |
parent | 94930d20ea241fddb5fa1668a08112dc1acc900d (diff) | |
download | coredns-c466003a943fac7dd78b25b672922a1a0944b59a.tar.gz coredns-c466003a943fac7dd78b25b672922a1a0944b59a.tar.zst coredns-c466003a943fac7dd78b25b672922a1a0944b59a.zip |
startup: add logo (#3230)
* startup: add logo
As discussed in #3225, lets add a little logo. This PR incorperates this
in the startup text. It also removes the logging output as this outputs
identical lines of text, but for no clear reason. This means --quiet now
means "no output on startup at all".
Currently it looks like this:
~~~
.:1053
______ ____ _ _______
/ ____/___ ________ / __ \/ | / / ___/ CoreDNS-1.6.2
/ / / __ \/ ___/ _ \/ / / / |/ /\__ \ linux/amd64, go1.12.9,
/ /___/ /_/ / / / __/ /_/ / /| /___/ /
\____/\____/_/ \___/_____/_/ |_//____/
~~~
We have 2 lines extra on the right if we need to print more (no ideas
come to mind currently).
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add distinct marker for grep and cut purposes
Signed-off-by: Miek Gieben <miek@miek.nl>
-rw-r--r-- | coremain/logo.go | 14 | ||||
-rw-r--r-- | coremain/run.go | 17 |
2 files changed, 20 insertions, 11 deletions
diff --git a/coremain/logo.go b/coremain/logo.go new file mode 100644 index 000000000..09db8de42 --- /dev/null +++ b/coremain/logo.go @@ -0,0 +1,14 @@ +package coremain + +// This is CoreDNS' ascii LOGO, nothing fancy. It's generated with: +// figlet -f slant CoreDNS +// We're printing the logo line by line, hence splitting it up. +var logo = []string{ + ` ______ ____ _ _______`, + ` / ____/___ ________ / __ \/ | / / ___/`, + ` / / / __ \/ ___/ _ \/ / / / |/ /\__ \ `, + `/ /___/ /_/ / / / __/ /_/ / /| /___/ / `, + `\____/\____/_/ \___/_____/_/ |_//____/ `, +} + +const marker = "~ " diff --git a/coremain/run.go b/coremain/run.go index 5f3b610bd..508c74c62 100644 --- a/coremain/run.go +++ b/coremain/run.go @@ -11,7 +11,6 @@ import ( "strings" "github.com/coredns/coredns/core/dnsserver" - clog "github.com/coredns/coredns/plugin/pkg/log" "github.com/caddyserver/caddy" ) @@ -82,7 +81,6 @@ func Run() { mustLogFatal(err) } - logVersion() if !dnsserver.Quiet { showVersion() } @@ -141,24 +139,21 @@ func defaultLoader(serverType string) (caddy.Input, error) { }, nil } -// logVersion logs the version that is starting. -func logVersion() { - clog.Info(versionString()) - clog.Info(releaseString()) -} - -// showVersion prints the version that is starting. +// showVersion prints the version that is starting. We print our logo on the left. func showVersion() { + fmt.Println(logo[0]) fmt.Print(versionString()) fmt.Print(releaseString()) if devBuild && gitShortStat != "" { fmt.Printf("%s\n%s\n", gitShortStat, gitFilesModified) } + fmt.Println(logo[3]) + fmt.Println(logo[4]) } // versionString returns the CoreDNS version as a string. func versionString() string { - return fmt.Sprintf("%s-%s\n", caddy.AppName, caddy.AppVersion) + return fmt.Sprintf("%s\t%s%s-%s\n", logo[1], marker, caddy.AppName, caddy.AppVersion) } // releaseString returns the release information related to CoreDNS version: @@ -166,7 +161,7 @@ func versionString() string { // e.g., // linux/amd64, go1.8.3, a6d2d7b5 func releaseString() string { - return fmt.Sprintf("%s/%s, %s, %s\n", runtime.GOOS, runtime.GOARCH, runtime.Version(), GitCommit) + return fmt.Sprintf("%s\t%s%s/%s, %s, %s\n", logo[2], marker, runtime.GOOS, runtime.GOARCH, runtime.Version(), GitCommit) } // setVersion figures out the version information |