mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25: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
|
globalApplicationLoggerTag string
|
||||||
appLogger *AppLogger
|
appLogger *AppLogger
|
||||||
initAppLogger sync.Once
|
initAppLogger sync.Once
|
||||||
syncTestingLog sync.Mutex
|
syncTestingLog sync.RWMutex
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -48,13 +48,13 @@ func format(msg string, keyvals ...interface{}) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (logger *AppLogger) testingLog(msg string, keyvals ...interface{}) {
|
func (logger *AppLogger) testingLog(msg string, keyvals ...interface{}) {
|
||||||
|
syncTestingLog.RLock()
|
||||||
|
defer syncTestingLog.RUnlock()
|
||||||
if logger.testingLogger == nil {
|
if logger.testingLogger == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
msg = format(msg, keyvals...)
|
msg = format(msg, keyvals...)
|
||||||
syncTestingLog.Lock()
|
|
||||||
logger.testingLogger.Logf(msg)
|
logger.testingLogger.Logf(msg)
|
||||||
syncTestingLog.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *AppLogger) Info(ctx sdk.Context, msg string, keyvals ...interface{}) {
|
func (logger *AppLogger) Info(ctx sdk.Context, msg string, keyvals ...interface{}) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user