Skip to content

Commit

Permalink
apply fixes from rs/zerolog#555 (comment), looks like race conditions…
Browse files Browse the repository at this point in the history
… gone away, need pull and resolve conflicts from master
  • Loading branch information
Slach committed Aug 12, 2023
1 parent eea4f62 commit 98245c3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/clickhouse/clickhouse.go
Expand Up @@ -908,16 +908,14 @@ func (ch *ClickHouse) SelectSingleRowNoCtx(dest interface{}, query string, args
}

func (ch *ClickHouse) LogQuery(query string, args ...interface{}) string {
var logF *zerolog.Event
level := zerolog.InfoLevel
if !ch.Config.LogSQLQueries {
logF = log.Debug()
} else {
logF = log.Info()
level = zerolog.DebugLevel
}
if len(args) > 0 {
logF.Msg(strings.NewReplacer("\n", " ", "\r", " ", "\t", " ").Replace(fmt.Sprintf("%s with args %v", query, args)))
log.WithLevel(level).Msgf(strings.NewReplacer("\n", " ", "\r", " ", "\t", " ").Replace(fmt.Sprintf("%s with args %v", query, args)))
} else {
logF.Msg(strings.NewReplacer("\n", " ", "\r", " ", "\t", " ").Replace(query))
log.WithLevel(level).Msg(strings.NewReplacer("\n", " ", "\r", " ", "\t", " ").Replace(query))
}
return query
}
Expand Down

0 comments on commit 98245c3

Please sign in to comment.