當前位置: 首頁>>代碼示例>>Golang>>正文


Golang cli.Args類代碼示例

本文整理匯總了Golang中github.com/minio/cli.Args的典型用法代碼示例。如果您正苦於以下問題:Golang Args類的具體用法?Golang Args怎麽用?Golang Args使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Args類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: enableLog2File

func enableLog2File(conf *config, args cli.Args) {
	if conf.IsSysloggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "Syslog logging already enabled. Please remove before enabling file.", nil)
	}
	if conf.IsMongoLoggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "Mongo logging already enabled. Please remove before enabling file.", nil)
	}
	conf.FileLogger.Filename = args.Get(0)
	err := saveConfig(conf.configV2)
	fatalIf(err.Trace(), "Unable to save config.", nil)
}
開發者ID:thesyncim,項目名稱:minio,代碼行數:11,代碼來源:config-logger-main.go

示例2: enableLog2Syslog

func enableLog2Syslog(conf *config, args cli.Args) {
	if conf.IsFileLoggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "File logging already enabled. Please remove before enabling syslog.", nil)
	}
	if conf.IsMongoLoggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "Mongo logging already enabled. Please remove before enabling syslog.", nil)
	}
	conf.SyslogLogger.Addr = args.Get(0)
	conf.SyslogLogger.Network = args.Get(1)
	err := saveConfig(conf.configV2)
	fatalIf(err.Trace(), "Unable to save config.", nil)
}
開發者ID:thesyncim,項目名稱:minio,代碼行數:12,代碼來源:config-logger-main.go

示例3: enableLog2File

func enableLog2File(conf *config, args cli.Args) {
	if conf.IsSysloggingEnabled() {
		Infoln("Syslog logging already enabled. Removing automatically by enabling file logging.")
		conf.SyslogLogger.Addr = ""
		conf.SyslogLogger.Network = ""
	}
	if conf.IsMongoLoggingEnabled() {
		Infoln("Mongo logging already enabled. Removing automatically by enabling file logging.")
		conf.MongoLogger.Addr = ""
		conf.MongoLogger.DB = ""
		conf.MongoLogger.Collection = ""
	}
	conf.FileLogger.Filename = args.Get(0)
	err := saveConfig(conf.configV2)
	fatalIf(err.Trace(), "Unable to save file logging config.", nil)
}
開發者ID:AcalephStorage,項目名稱:minio,代碼行數:16,代碼來源:config-logger-main.go

示例4: enableLog2Mongo

func enableLog2Mongo(conf *config, args cli.Args) {
	if conf.IsFileLoggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "File logging already enabled. Please remove before enabling mongo.", nil)
	}
	if conf.IsSysloggingEnabled() {
		fatalIf(probe.NewError(errInvalidArgument), "Syslog logging already enabled. Please remove before enabling mongo.", nil)
	}
	conf.MongoLogger.Addr = args.Get(0)
	conf.MongoLogger.DB = args.Get(1)
	conf.MongoLogger.Collection = args.Get(2)

	err := saveConfig(conf.configV2)
	fatalIf(err.Trace(), "Unable to save config.", nil)
}
開發者ID:thesyncim,項目名稱:minio,代碼行數:14,代碼來源:config-logger-main.go


注:本文中的github.com/minio/cli.Args類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。