Add a prefix to the logger
This will make it easier to differentiate between airship log messages and third-party log message (e.g. clusterctl) Change-Id: I0b8a2fed58a6a673277f511267e2498c7e8d4c1b
This commit is contained in:
parent
54d7b5f229
commit
07896b97c5
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
debug = false
|
debug = false
|
||||||
airshipLog = log.New(os.Stderr, "", log.LstdFlags)
|
airshipLog = log.New(os.Stderr, "[airshipctl] ", log.LstdFlags)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Init initializes settings related to logging
|
// Init initializes settings related to logging
|
||||||
|
@ -25,9 +25,9 @@ import (
|
|||||||
"opendev.org/airship/airshipctl/pkg/log"
|
"opendev.org/airship/airshipctl/pkg/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logFormatRegex = regexp.MustCompile(`^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*`)
|
var logFormatRegex = regexp.MustCompile(`^\[airshipctl\] \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*`)
|
||||||
|
|
||||||
const prefixLength = len("2001/02/03 16:05:06 ")
|
const prefixLength = len("[airshipctl] 2001/02/03 16:05:06 ")
|
||||||
|
|
||||||
func TestLoggingPrintf(t *testing.T) {
|
func TestLoggingPrintf(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
Loading…
Reference in New Issue
Block a user