Single line logging in tests and default Configuration.logSQL

This commit is contained in:
Gwendal Roué committed 2015-09-05 21:47:38 +02:00
1 parent 695adcacf7
commit e0551e17fc
2 files changed
+6 -4

No files matched your search

+3 -2
View File
@@ -14,9 +14,10 @@ class GRDBTestCase: XCTestCase {
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
let configuration = Configuration(trace: { (sql, arguments) in
self.sqlQueries.append(sql)
NSLog("GRDB: %@", sql)
if let arguments = arguments {
NSLog("GRDB: arguments %@", arguments.description)
NSLog("GRDB: %@ -- arguments: %@", sql, arguments.description)
} else {
NSLog("GRDB: %@", sql)
}
})
dbQueue = try! DatabaseQueue(path: databasePath, configuration: configuration)
+3 -2
View File
@@ -7,9 +7,10 @@ public struct Configuration {
/// A tracing function that logs SQL statements
public static func logSQL(sql: String, arguments: StatementArguments?) {
NSLog("GRDB: %@", sql)
if let arguments = arguments {
NSLog("GRDB: arguments %@", arguments.description)
NSLog("GRDB: %@ -- arguments: %@", sql, arguments.description)
} else {
NSLog("GRDB: %@", sql)
}
}