-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch updates the pinning scripts to replace Fabric, Fabric CA, & CFSSL logging mechanism with the SDK logger. The SDK packages are also updated to use the SDK logger. Change-Id: I16c8bd54b3d22caab526d07a3c27bd479b83226e Signed-off-by: Troy Ronda <troy.ronda@securekey.com>
- Loading branch information
Showing
47 changed files
with
431 additions
and
337 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
internal/github.com/hyperledger/fabric-ca/lib/logbridge/logbridge.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package logbridge | ||
|
||
import ( | ||
clog "github.com/cloudflare/cfssl/log" | ||
"github.com/hyperledger/fabric-sdk-go/pkg/logging" | ||
) | ||
|
||
var logger *logging.Logger | ||
var cfLogBridge *cLogger | ||
|
||
func init() { | ||
logger = logging.NewLogger("fabric_sdk_go") | ||
cfLogBridge = &cLogger{} | ||
clog.SetLogger(cfLogBridge) | ||
} | ||
|
||
// Debug bridges calls to the Go SDK logger's Debug. | ||
func Debug(args ...interface{}) { | ||
logger.Debug(args...) | ||
} | ||
|
||
// Debugf bridges calls to the Go SDK logger's Debugf. | ||
func Debugf(format string, args ...interface{}) { | ||
logger.Debugf(format, args) | ||
} | ||
|
||
// Info bridges calls to the Go SDK logger's Info. | ||
func Info(args ...interface{}) { | ||
logger.Info(args...) | ||
} | ||
|
||
// Infof bridges calls to the Go SDK logger's Debugf. | ||
func Infof(format string, args ...interface{}) { | ||
logger.Infof(format, args...) | ||
} | ||
|
||
// Fatalf bridges calls to the Go SDK logger's Debugf. | ||
func Fatalf(format string, args ...interface{}) { | ||
logger.Fatalf(format, args...) | ||
} |
41 changes: 41 additions & 0 deletions
41
internal/github.com/hyperledger/fabric-ca/lib/logbridge/syslogwriter.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package logbridge | ||
|
||
// cLogger implements CFSSL's SyslogWriter interface | ||
type cLogger struct { | ||
} | ||
|
||
// Debug bridges calls to the Go SDK logger's Debug. | ||
func (log *cLogger) Debug(s string) { | ||
logger.Debug(s) | ||
} | ||
|
||
// Info bridges calls to the Go SDK logger's Info. | ||
func (log *cLogger) Info(s string) { | ||
logger.Info(s) | ||
} | ||
|
||
// Warning bridges calls to the Go SDK logger's Warn. | ||
func (log *cLogger) Warning(s string) { | ||
logger.Warn(s) | ||
} | ||
|
||
// Err bridges calls to the Go SDK logger's Error. | ||
func (log *cLogger) Err(s string) { | ||
logger.Error(s) | ||
} | ||
|
||
// Crit bridges calls to the Go SDK logger's Error. | ||
func (log *cLogger) Crit(s string) { | ||
logger.Error(s) | ||
} | ||
|
||
// Emerg bridges calls to the Go SDK logger's Error. | ||
func (log *cLogger) Emerg(s string) { | ||
logger.Error(s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
internal/github.com/hyperledger/fabric/common/logbridge/logbridge.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package logbridge | ||
|
||
import ( | ||
"github.com/hyperledger/fabric-sdk-go/pkg/logging" | ||
) | ||
|
||
// Log levels (from fabric-sdk-go/pkg/logging/level.go). | ||
const ( | ||
CRITICAL logging.Level = iota | ||
ERROR | ||
WARNING | ||
INFO | ||
DEBUG | ||
) | ||
|
||
// Logger bridges the SDK's logger struct | ||
type Logger struct { | ||
*logging.Logger | ||
module string | ||
} | ||
|
||
// MustGetLogger bridges calls the Go SDK NewLogger | ||
func MustGetLogger(module string) *Logger { | ||
fabModule := "fabric_sdk_go" | ||
logger := logging.NewLogger(fabModule) | ||
return &Logger{ | ||
Logger: logger, | ||
module: fabModule, | ||
} | ||
} | ||
|
||
// Warningf bridges calls to the Go SDK logger's Warnf. | ||
func (l *Logger) Warningf(format string, args ...interface{}) { | ||
l.Warnf(format, args...) | ||
} | ||
|
||
// Warning bridges calls to the Go SDK logger's Warn. | ||
func (l *Logger) Warning(format string, args ...interface{}) { | ||
l.Warn(args...) | ||
} | ||
|
||
// IsEnabledFor bridges calls to the Go SDK logger's IsEnabledFor. | ||
func (l *Logger) IsEnabledFor(level logging.Level) bool { | ||
return logging.IsEnabledFor(level, l.module) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.