mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-23 22:15:47 +00:00
TestingLocker Mutex to RWMutex (increase performance)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
ac9b7a2a55
commit
cafc59d178
@ -16,7 +16,7 @@ var (
|
||||
globalApplicationLoggerTag string
|
||||
appLogger *AppLogger
|
||||
initAppLogger sync.Once
|
||||
syncTestingLog sync.Mutex
|
||||
syncTestingLog sync.RWMutex
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -48,13 +48,13 @@ func format(msg string, keyvals ...interface{}) string {
|
||||
}
|
||||
|
||||
func (logger *AppLogger) testingLog(msg string, keyvals ...interface{}) {
|
||||
syncTestingLog.RLock()
|
||||
defer syncTestingLog.RUnlock()
|
||||
if logger.testingLogger == nil {
|
||||
return
|
||||
}
|
||||
msg = format(msg, keyvals...)
|
||||
syncTestingLog.Lock()
|
||||
logger.testingLogger.Logf(msg)
|
||||
syncTestingLog.Unlock()
|
||||
}
|
||||
|
||||
func (logger *AppLogger) Info(ctx sdk.Context, msg string, keyvals ...interface{}) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user