Skip to content

Commit 858e8cd

Browse files
authored
Remove goutils logger (#7886)
1 parent 27f3016 commit 858e8cd

File tree

2 files changed

+1
-97
lines changed

2 files changed

+1
-97
lines changed

base/logger_external.go

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ package base
1212

1313
import (
1414
"context"
15-
"fmt"
16-
"os"
1715

1816
"github.com/couchbase/clog"
1917
"github.com/couchbase/gocb/v2"
2018
"github.com/couchbase/gocbcore/v10"
21-
"github.com/couchbase/goutils/logging"
2219
"github.com/couchbaselabs/rosmar"
2320
)
2421

@@ -36,7 +33,6 @@ func initExternalLoggers() {
3633
gocbcore.SetLogger(GoCBCoreLogger{})
3734
}
3835

39-
logging.SetLogger(CBGoUtilsLogger{})
4036
clog.SetLoggerCallback(ClogCallback)
4137
// Set the clog level to DEBUG and do filtering for debug inside ClogCallback functions
4238
clog.SetLevel(clog.LevelDebug)
@@ -159,98 +155,6 @@ func ClogCallback(level, format string, v ...any) string {
159155
return ""
160156
}
161157

162-
// **************************************************************
163-
// Implementation for github.com/couchbase/goutils/logging.Logger
164-
// **************************************************************
165-
type CBGoUtilsLogger struct{}
166-
167-
var _ logging.Logger = CBGoUtilsLogger{}
168-
169-
func (CBGoUtilsLogger) SetLevel(l logging.Level) {
170-
// no-op
171-
}
172-
173-
// CBGoUtilsLogger.Level returns a compatible go-couchbase/golog Log Level for
174-
// the given logging config LogLevel
175-
func (CBGoUtilsLogger) Level() logging.Level {
176-
logger := consoleLogger.Load()
177-
if logger == nil || logger.LogLevel == nil {
178-
return logging.INFO
179-
}
180-
switch *logger.LogLevel {
181-
case LevelTrace:
182-
return logging.TRACE
183-
case LevelDebug:
184-
return logging.DEBUG
185-
case LevelInfo:
186-
return logging.INFO
187-
case LevelWarn:
188-
return logging.WARN
189-
case LevelError:
190-
return logging.ERROR
191-
case LevelNone:
192-
return logging.NONE
193-
default:
194-
return logging.NONE
195-
}
196-
}
197-
198-
func (CBGoUtilsLogger) Fatalf(fmt string, args ...any) {
199-
logTo(context.TODO(), LevelError, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
200-
FlushLogBuffers()
201-
os.Exit(1)
202-
}
203-
204-
func (CBGoUtilsLogger) Severef(fmt string, args ...any) {
205-
logTo(context.TODO(), LevelError, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
206-
}
207-
208-
func (CBGoUtilsLogger) Errorf(fmt string, args ...any) {
209-
logTo(context.TODO(), LevelError, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
210-
}
211-
212-
func (CBGoUtilsLogger) Warnf(fmt string, args ...any) {
213-
logTo(context.TODO(), LevelWarn, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
214-
}
215-
216-
func (CBGoUtilsLogger) Infof(fmt string, args ...any) {
217-
logTo(context.TODO(), LevelInfo, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
218-
}
219-
220-
func (CBGoUtilsLogger) Requestf(rlevel logging.Level, fmt string, args ...any) {
221-
logTo(context.TODO(), LevelTrace, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
222-
}
223-
224-
func (CBGoUtilsLogger) Tracef(fmt string, args ...any) {
225-
logTo(context.TODO(), LevelTrace, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
226-
}
227-
228-
func (CBGoUtilsLogger) Debugf(fmt string, args ...any) {
229-
logTo(context.TODO(), LevelDebug, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
230-
}
231-
232-
func (CBGoUtilsLogger) Logf(level logging.Level, fmt string, args ...any) {
233-
logTo(context.TODO(), LevelInfo, KeyAll, "CBGoUtilsLogger: "+fmt, args...)
234-
}
235-
236-
// go-couchbase/gomemcached don't use Pair/Map logs, so these are all stubs
237-
238-
func (l CBGoUtilsLogger) Loga(level logging.Level, f func() string) { l.warnNotImplemented("Loga", f) }
239-
func (l CBGoUtilsLogger) Debuga(f func() string) { l.warnNotImplemented("Debuga", f) }
240-
func (l CBGoUtilsLogger) Tracea(f func() string) { l.warnNotImplemented("Tracea", f) }
241-
func (l CBGoUtilsLogger) Requesta(rlevel logging.Level, f func() string) {
242-
l.warnNotImplemented("Requesta", f)
243-
}
244-
func (l CBGoUtilsLogger) Infoa(f func() string) { l.warnNotImplemented("Infoa", f) }
245-
func (l CBGoUtilsLogger) Warna(f func() string) { l.warnNotImplemented("Warna", f) }
246-
func (l CBGoUtilsLogger) Errora(f func() string) { l.warnNotImplemented("Errora", f) }
247-
func (l CBGoUtilsLogger) Severea(f func() string) { l.warnNotImplemented("Severea", f) }
248-
func (l CBGoUtilsLogger) Fatala(f func() string) { l.warnNotImplemented("Fatala", f) }
249-
250-
func (CBGoUtilsLogger) warnNotImplemented(name string, f func() string) {
251-
WarnfCtx(context.Background(), fmt.Sprintf("CBGoUtilsLogger: %s not implemented! %s", name, f()))
252-
}
253-
254158
// **************************************************************************
255159
// Log callback for Rosmar
256160
// **************************************************************************

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require (
1313
github.com/couchbase/gocb/v2 v2.11.1
1414
github.com/couchbase/gocbcore/v10 v10.8.1
1515
github.com/couchbase/gomemcached v0.2.1
16-
github.com/couchbase/goutils v0.1.2
1716
github.com/couchbase/sg-bucket v0.0.0-20250522135601-8c9a5acda2c2
1817
github.com/couchbasedeps/fast-skiplist v0.0.0-20250722125747-e0dd031fe2ac
1918
github.com/couchbaselabs/go-fleecedelta v0.0.0-20220909152808-6d09efa7a338
@@ -50,6 +49,7 @@ require (
5049
github.com/couchbase/go-couchbase v0.1.1 // indirect
5150
github.com/couchbase/gocbcoreps v0.1.4 // indirect
5251
github.com/couchbase/goprotostellar v1.0.2 // indirect
52+
github.com/couchbase/goutils v0.1.2 // indirect
5353
github.com/couchbase/tools-common/cloud/v5 v5.0.3 // indirect
5454
github.com/couchbase/tools-common/fs v1.0.2 // indirect
5555
github.com/couchbase/tools-common/testing v1.0.1 // indirect

0 commit comments

Comments
 (0)