Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 0267245

Browse files
committed
live: Add some debugging output for AMQP messages
1 parent 082ca49 commit 0267245

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

live/main.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ func main() {
159159
continue
160160
}
161161

162+
if com.AmqpDebug {
163+
log.Printf("Running BACKUP on '%s/%s'", req.DBOwner, req.DBName)
164+
}
165+
162166
// Return a success message to the caller
163167
resp := com.LiveDBErrorResponse{Node: com.Conf.Live.Nodename, Error: ""} // Use an empty error message to indicate success
164168
err = com.MQResponse("BACKUP", msg, ch, com.Conf.Live.Nodename, resp)
@@ -180,6 +184,10 @@ func main() {
180184
continue
181185
}
182186

187+
if com.AmqpDebug {
188+
log.Printf("Running COLUMNS on '%s/%s': '%s'", req.DBOwner, req.DBName, req.Data)
189+
}
190+
183191
// Return the columns list to the caller
184192
resp := com.LiveDBColumnsResponse{Node: com.Conf.Live.Nodename, Columns: columns, Error: "", ErrCode: com.AMQPNoError}
185193
err = com.MQResponse("COLUMNS", msg, ch, com.Conf.Live.Nodename, resp)
@@ -200,6 +208,10 @@ func main() {
200208
continue
201209
}
202210

211+
if com.AmqpDebug {
212+
log.Printf("Running DELETE on '%s/%s'", req.DBOwner, req.DBName)
213+
}
214+
203215
// Return a success message (empty string in this case) to the caller
204216
resp := com.LiveDBErrorResponse{Node: com.Conf.Live.Nodename, Error: ""}
205217
err = com.MQResponse("DELETE", msg, ch, com.Conf.Live.Nodename, resp)
@@ -221,6 +233,10 @@ func main() {
221233
continue
222234
}
223235

236+
if com.AmqpDebug {
237+
log.Printf("Running EXECUTE on '%s/%s': '%s'", req.DBOwner, req.DBName, req.Data)
238+
}
239+
224240
// Return a success message to the caller
225241
resp := com.LiveDBExecuteResponse{Node: com.Conf.Live.Nodename, RowsChanged: rowsChanged, Error: ""}
226242
err = com.MQResponse("EXECUTE", msg, ch, com.Conf.Live.Nodename, resp)
@@ -241,6 +257,10 @@ func main() {
241257
continue
242258
}
243259

260+
if com.AmqpDebug {
261+
log.Printf("Running INDEXES on '%s/%s'", req.DBOwner, req.DBName)
262+
}
263+
244264
// Return the indexes list to the caller
245265
resp := com.LiveDBIndexesResponse{Node: com.Conf.Live.Nodename, Indexes: indexes, Error: ""}
246266
err = com.MQResponse("INDEXES", msg, ch, com.Conf.Live.Nodename, resp)
@@ -261,6 +281,10 @@ func main() {
261281
continue
262282
}
263283

284+
if com.AmqpDebug {
285+
log.Printf("Running QUERY on '%s/%s': '%s'", req.DBOwner, req.DBName, req.Data)
286+
}
287+
264288
// Return the query response to the caller
265289
resp := com.LiveDBQueryResponse{Node: com.Conf.Live.Nodename, Results: rows, Error: ""}
266290
err = com.MQResponse("QUERY", msg, ch, com.Conf.Live.Nodename, resp)
@@ -294,6 +318,10 @@ func main() {
294318
continue
295319
}
296320

321+
if com.AmqpDebug {
322+
log.Printf("Running ROWDATA on '%s/%s'", req.DBOwner, req.DBName)
323+
}
324+
297325
// Return the row data to the caller
298326
err = com.MQResponse("ROWDATA", msg, ch, com.Conf.Live.Nodename, resp)
299327
if err != nil {
@@ -313,6 +341,10 @@ func main() {
313341
continue
314342
}
315343

344+
if com.AmqpDebug {
345+
log.Printf("Running TABLES on '%s/%s'", req.DBOwner, req.DBName)
346+
}
347+
316348
// Return the tables list to the caller
317349
resp := com.LiveDBTablesResponse{Node: com.Conf.Live.Nodename, Tables: tables, Error: ""}
318350
err = com.MQResponse("TABLES", msg, ch, com.Conf.Live.Nodename, resp)
@@ -333,6 +365,10 @@ func main() {
333365
continue
334366
}
335367

368+
if com.AmqpDebug {
369+
log.Printf("Running VIEWS on '%s/%s'", req.DBOwner, req.DBName)
370+
}
371+
336372
// Return the views list to the caller
337373
resp := com.LiveDBViewsResponse{Node: com.Conf.Live.Nodename, Views: views, Error: ""}
338374
err = com.MQResponse("VIEWS", msg, ch, com.Conf.Live.Nodename, resp)

0 commit comments

Comments
 (0)