-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed race in ddl commands cleanup (#481)
* Fixed race in ddl commands cleanup * Call cleanup on error
- Loading branch information
Showing
6 changed files
with
63 additions
and
56 deletions.
There are no files selected for viewing
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,54 @@ | ||
package logadaptor | ||
|
||
import ( | ||
"github.com/lni/dragonboat/v3/logger" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
/* | ||
This adaptor allows us to plug the dragonboat logging into the logrus logger we use in Prana. | ||
*/ | ||
|
||
func init() { | ||
logger.SetLoggerFactory(logrusLogFactory) | ||
} | ||
|
||
func logrusLogFactory(pkgName string) logger.ILogger { | ||
return &LogrusILogger{} | ||
} | ||
|
||
type LogrusILogger struct { | ||
level logger.LogLevel | ||
} | ||
|
||
func (l *LogrusILogger) SetLevel(level logger.LogLevel) { | ||
l.level = level | ||
} | ||
|
||
func (l *LogrusILogger) Debugf(format string, args ...interface{}) { | ||
if l.level >= logger.DEBUG { | ||
log.Debugf(format, args...) | ||
} | ||
} | ||
|
||
func (l *LogrusILogger) Infof(format string, args ...interface{}) { | ||
if l.level >= logger.INFO { | ||
log.Infof(format, args...) | ||
} | ||
} | ||
|
||
func (l *LogrusILogger) Warningf(format string, args ...interface{}) { | ||
if l.level >= logger.WARNING { | ||
log.Warnf(format, args...) | ||
} | ||
} | ||
|
||
func (l *LogrusILogger) Errorf(format string, args ...interface{}) { | ||
if l.level >= logger.ERROR { | ||
log.Errorf(format, args...) | ||
} | ||
} | ||
|
||
func (l *LogrusILogger) Panicf(format string, args ...interface{}) { | ||
log.Fatalf(format, args...) | ||
} |
This file was deleted.
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
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