Example #1
0
File: main.go Project: rdrew4/cfops
func init() {

	if logLevel = os.Getenv(logLevelEnv); logLevel != "" {
		log.SetLogLevel(logLevel)
		logger = log.LogFactory("cfops cli", log.Lager, os.Stdout)
		logger.Debug("log level set", log.Data{"level": logLevel})
		cfops.SetLogger(logger)
	}
}
Example #2
0
func init() {
	ExitCode = cleanExitCode

	if logLevel = os.Getenv(logLevelEnv); logLevel != "" {
		log.SetLogLevel(logLevel)
		logger = log.LogFactory("cfdatamanager cli", log.Lager, os.Stdout)
		logger.Debug("log level set", log.Data{"level": logLevel})
		cfdatamanager.SetLogger(logger)
	}
}
Example #3
0
func getLogger(minLogLevel string) log.Logger {
	log.SetLogLevel(minLogLevel)
	return log.LogFactory("TestLogger", log.Lager, os.Stdout)
}
Example #4
0
func NewTestLogger(component string) *TestLogger {
	buffer := gbytes.NewBuffer()
	testSink := NewTestSink(buffer)
	logger := log.LogFactory(component, log.Lager, buffer)
	return &TestLogger{logger, testSink}
}
Example #5
0
func init() {
	backupLogger = log.LogFactory("cfbackup default logger", log.Lager, os.Stdout)
}
Example #6
0
const (
	ErrUnsupportedTileFormat = "you have a unsupported tile in your list: %s"
	loggerName               = "cfops"
	Restore                  = "restore"
	Backup                   = "backup"
	OpsMgr                   = "OPSMANAGER"
	ER                       = "ER"
)

var (
	BuiltinPipelineExecution = map[string]func(string, string, string, string, string) error{
		Restore: cfbackup.RunRestorePipeline,
		Backup:  cfbackup.RunBackupPipeline,
	}
	SupportedTiles map[string]func() (Tile, error)
	backupLogger   log.Logger = log.LogFactory("cfops default logger", log.Lager, os.Stdout)
)

func ErrUnsupportedTile(errString string) error {
	return fmt.Errorf(ErrUnsupportedTileFormat, errString)
}

type Tile interface {
	Backup() error
	Restore() error
}

func hasTilelistFlag(fs flagSet) bool {
	return (fs.Tilelist() != "")
}