Skip to content

Commit 8ee94fd

Browse files
committed
#113 use std.experimental.logger
1 parent a21acc9 commit 8ee94fd

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,10 @@ ddoc/packageVersion.ddoc
2424
source/mysql/packageVersion.d
2525

2626
/unit-threaded-*
27+
28+
# Ignore Intellij IDE files:
29+
.idea/
30+
*.iml
31+
32+
# Ignore Sublime Text workspace (project file is ok):
33+
*.sublime-workspace

source/mysql/connection.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module mysql.connection;
44
import std.algorithm;
55
import std.conv;
66
import std.exception;
7+
import std.experimental.logger;
78
import std.range;
89
import std.socket;
910
import std.string;
@@ -438,6 +439,7 @@ package:
438439

439440
static PlainPhobosSocket defaultOpenSocketPhobos(string host, ushort port)
440441
{
442+
tracef("opening Vibed socket %s:%s", host, port);
441443
auto s = new PlainPhobosSocket();
442444
s.connect(new InternetAddress(host, port));
443445
return s;
@@ -446,7 +448,10 @@ package:
446448
static PlainVibeDSocket defaultOpenSocketVibeD(string host, ushort port)
447449
{
448450
version(Have_vibe_d_core)
451+
{
452+
tracef("opening Vibed socket %s:%s", host, port);
449453
return vibe.core.net.connectTCP(host, port);
454+
}
450455
else
451456
assert(0);
452457
}

source/mysql/protocol/comms.d

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import std.algorithm;
2424
import std.conv;
2525
import std.digest.sha;
2626
import std.exception;
27+
import std.experimental.logger;
2728
import std.range;
2829
import std.variant;
2930

@@ -511,9 +512,13 @@ package(mysql) bool execQueryImpl(Connection conn, ExecQueryImplInfo info, out u
511512

512513
// Send data
513514
if(info.isPrepared)
515+
{
516+
tracef("prepared SQL: %s", info.hStmt);
514517
ProtocolPrepared.sendCommand(conn, info.hStmt, info.psh, info.inParams, info.psa);
518+
}
515519
else
516520
{
521+
tracef("exec query: %s", info.sql);
517522
conn.sendCmd(CommandType.QUERY, info.sql);
518523
conn._fieldCount = 0;
519524
}
@@ -525,6 +530,7 @@ package(mysql) bool execQueryImpl(Connection conn, ExecQueryImplInfo info, out u
525530
{
526531
conn.resetPacket();
527532
auto okp = OKErrorPacket(packet);
533+
logf(LogLevel.error, okp.error, "mysql error: %s", okp.message);
528534
enforcePacketOK(okp);
529535
ra = okp.affected;
530536
conn._serverStatus = okp.serverStatus;

0 commit comments

Comments
 (0)