Renamed existing debug logging functions.

geesefs-0-30-9
Aaron Jacobs 2015-05-25 14:13:24 +10:00
parent df7aea90d2
commit e0db5cf622
3 changed files with 18 additions and 18 deletions

View File

@ -40,7 +40,7 @@ var fTraceByPID = flag.Bool(
// A connection to the fuse kernel process.
type Connection struct {
logger *log.Logger
debugLogger *log.Logger
wrapped *bazilfuse.Conn
opsInFlight sync.WaitGroup
@ -68,10 +68,10 @@ type Connection struct {
// result. You must call c.close() eventually.
func newConnection(
parentCtx context.Context,
logger *log.Logger,
debugLogger *log.Logger,
wrapped *bazilfuse.Conn) (c *Connection, err error) {
c = &Connection{
logger: logger,
debugLogger: debugLogger,
wrapped: wrapped,
parentCtx: parentCtx,
cancelFuncs: make(map[bazilfuse.RequestID]func()),
@ -83,7 +83,7 @@ func newConnection(
// Log information for an operation with the given ID. calldepth is the depth
// to use when recovering file:line information with runtime.Caller.
func (c *Connection) log(
func (c *Connection) debugLog(
opID uint32,
calldepth int,
format string,
@ -108,7 +108,7 @@ func (c *Connection) log(
fmt.Sprintf(format, v...))
// Print it.
c.logger.Println(msg)
c.debugLogger.Println(msg)
}
// LOCKS_EXCLUDED(c.mu)
@ -316,13 +316,13 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
c.nextOpID++
// Log the receipt of the operation.
c.log(opID, 1, "<- %v", bfReq)
c.debugLog(opID, 1, "<- %v", bfReq)
// Special case: responding to statfs is required to make mounting work on
// OS X. We don't currently expose the capability for the file system to
// intercept this.
if statfsReq, ok := bfReq.(*bazilfuse.StatfsRequest); ok {
c.log(opID, 1, "-> (Statfs) OK")
c.debugLog(opID, 1, "-> (Statfs) OK")
statfsReq.Respond(&bazilfuse.StatfsResponse{})
continue
}
@ -336,13 +336,13 @@ func (c *Connection) ReadOp() (op fuseops.Op, err error) {
// Set up op dependencies.
opCtx := c.beginOp(bfReq)
logForOp := func(calldepth int, format string, v ...interface{}) {
c.log(opID, calldepth+1, format, v...)
debugLogForOp := func(calldepth int, format string, v ...interface{}) {
c.debugLog(opID, calldepth+1, format, v...)
}
finished := func(err error) { c.finishOp(bfReq) }
op = fuseops.Convert(opCtx, bfReq, logForOp, finished)
op = fuseops.Convert(opCtx, bfReq, debugLogForOp, finished)
return
}
}

View File

@ -46,9 +46,9 @@ type commonOp struct {
// The underlying bazilfuse request for this op.
bazilReq bazilfuse.Request
// A function that can be used to log information about the op. The first
// argument is a call depth.
log func(int, string, ...interface{})
// A function that can be used to log debug information about the op. The
// first argument is a call depth.
debugLog func(int, string, ...interface{})
// A function that is invoked with the error given to Respond, for use in
// closing off traces and reporting back to the connection.
@ -76,13 +76,13 @@ func (o *commonOp) init(
ctx context.Context,
op internalOp,
bazilReq bazilfuse.Request,
log func(int, string, ...interface{}),
debugLog func(int, string, ...interface{}),
finished func(error)) {
// Initialize basic fields.
o.ctx = ctx
o.op = op
o.bazilReq = bazilReq
o.log = log
o.debugLog = debugLog
o.finished = finished
// Set up a trace span for this op.
@ -111,7 +111,7 @@ func (o *commonOp) Context() context.Context {
func (o *commonOp) Logf(format string, v ...interface{}) {
const calldepth = 2
o.log(calldepth, format, v...)
o.debugLog(calldepth, format, v...)
}
func (o *commonOp) Respond(err error) {

View File

@ -34,7 +34,7 @@ import (
func Convert(
opCtx context.Context,
r bazilfuse.Request,
logForOp func(int, string, ...interface{}),
debugLogForOp func(int, string, ...interface{}),
finished func(error)) (o Op) {
var co *commonOp
@ -239,7 +239,7 @@ func Convert(
co = &to.commonOp
}
co.init(opCtx, io, r, logForOp, finished)
co.init(opCtx, io, r, debugLogForOp, finished)
o = io
return