@@ -12,13 +12,10 @@ package base
1212
1313import (
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// **************************************************************************
0 commit comments