本文整理匯總了Golang中github.com/hyperledger/fabric/flogging.LoggingInit函數的典型用法代碼示例。如果您正苦於以下問題:Golang LoggingInit函數的具體用法?Golang LoggingInit怎麽用?Golang LoggingInit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了LoggingInit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestLoggingLevelForUnknownCommandGoesToDefault
func TestLoggingLevelForUnknownCommandGoesToDefault(t *testing.T) {
viper.Reset()
flogging.LoggingInit("unknown command")
assertDefaultLoggingLevel(t, flogging.DefaultLoggingLevel())
}
示例2: TestLoggingLevelDefault
func TestLoggingLevelDefault(t *testing.T) {
viper.Reset()
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, flogging.DefaultLoggingLevel())
}
示例3: TestLoggingLevelForSpecificModule
func TestLoggingLevelForSpecificModule(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "core=info")
flogging.LoggingInit("")
assertModuleLoggingLevel(t, "core", logging.INFO)
}
示例4: TestLoggingLevelOtherThanDefault
func TestLoggingLevelOtherThanDefault(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "warning")
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, logging.WARNING)
}
示例5: TestLoggingLevelInvalidEmptyModule
func TestLoggingLevelInvalidEmptyModule(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "=warning")
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, flogging.DefaultLoggingLevel())
}
示例6: TestLoggingLevelInvalidModules
func TestLoggingLevelInvalidModules(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "core=invalid")
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, flogging.DefaultLoggingLevel())
}
示例7: TestLoggingLevelForSpecificCommand
func TestLoggingLevelForSpecificCommand(t *testing.T) {
viper.Reset()
viper.Set("logging.node", "error")
flogging.LoggingInit("node")
assertDefaultLoggingLevel(t, logging.ERROR)
}
示例8: TestLoggingLevelInvalidModuleSyntax
func TestLoggingLevelInvalidModuleSyntax(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "type=warn=again")
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, flogging.DefaultLoggingLevel())
}
示例9: TestLoggingLevelForModuleWithDefaultAtEnd
func TestLoggingLevelForModuleWithDefaultAtEnd(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "test=warning:info")
flogging.LoggingInit("")
assertDefaultLoggingLevel(t, logging.INFO)
assertModuleLoggingLevel(t, "test", logging.WARNING)
}
示例10: TestLoggingLevelForMultipleModulesAtSameLevel
func TestLoggingLevelForMultipleModulesAtSameLevel(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "core,test=warning")
flogging.LoggingInit("")
assertModuleLoggingLevel(t, "core", logging.WARNING)
assertModuleLoggingLevel(t, "test", logging.WARNING)
}
示例11: TestLoggingLeveltForMultipleModules
func TestLoggingLeveltForMultipleModules(t *testing.T) {
viper.Reset()
viper.Set("logging_level", "core=warning:test=debug")
flogging.LoggingInit("")
assertModuleLoggingLevel(t, "core", logging.WARNING)
assertModuleLoggingLevel(t, "test", logging.DEBUG)
}
示例12: NewCA
// NewCA sets up a new CA.
func NewCA(name string, initTables TableInitializer) *CA {
ca := new(CA)
flogging.LoggingInit("ca")
ca.path = filepath.Join(rootPath, caDir)
if _, err := os.Stat(ca.path); err != nil {
caLogger.Info("Fresh start; creating databases, key pairs, and certificates.")
if err := os.MkdirAll(ca.path, 0755); err != nil {
caLogger.Panic(err)
}
}
// open or create certificate database
db, err := sql.Open("sqlite3", ca.path+"/"+name+".db")
if err != nil {
caLogger.Panic(err)
}
if err = db.Ping(); err != nil {
caLogger.Panic(err)
}
if err = initTables(db); err != nil {
caLogger.Panic(err)
}
ca.db = db
// read or create signing key pair
priv, err := ca.readCAPrivateKey(name)
if err != nil {
priv = ca.createCAKeyPair(name)
}
ca.priv = priv
// read CA certificate, or create a self-signed CA certificate
raw, err := ca.readCACertificate(name)
if err != nil {
raw = ca.createCACertificate(name, &ca.priv.PublicKey)
}
cert, err := x509.ParseCertificate(raw)
if err != nil {
caLogger.Panic(err)
}
ca.raw = raw
ca.cert = cert
return ca
}
示例13: NewTCA
// NewTCA sets up a new TCA.
func NewTCA(eca *ECA) *TCA {
tca := &TCA{NewCA("tca", initializeTCATables), eca, nil, nil, nil, nil}
flogging.LoggingInit("tca")
err := tca.readHmacKey()
if err != nil {
tcaLogger.Panic(err)
}
err = tca.readRootPreKey()
if err != nil {
tcaLogger.Panic(err)
}
err = tca.initializePreKeyTree()
if err != nil {
tcaLogger.Panic(err)
}
return tca
}
示例14: NewACA
// NewACA sets up a new ACA.
func NewACA() *ACA {
aca := &ACA{CA: NewCA("aca", initializeACATables)}
flogging.LoggingInit("aca")
return aca
}
示例15: NewTLSCA
// NewTLSCA sets up a new TLSCA.
//
func NewTLSCA(eca *ECA) *TLSCA {
tlsca := &TLSCA{NewCA("tlsca", initializeTLSCATables), eca, nil}
flogging.LoggingInit("tlsca")
return tlsca
}