Commit a9f5adfa authored by Shawn Webb's avatar Shawn Webb
Browse files

Add test code for integrating the SQLite3-baserd logger


Signed-off-by: Shawn Webb's avatarShawn Webb <shawn.webb@hardenedbsd.org>
parent a650f379
...@@ -49,13 +49,20 @@ main(int argc, char *argv[]) ...@@ -49,13 +49,20 @@ main(int argc, char *argv[])
lattutil_log_stdio_init(logp); lattutil_log_stdio_init(logp);
sqlctx = lattutil_sqlite_ctx_new("/tmp/db.sqlite3", logp, sqlctx = lattutil_sqlite_ctx_new("/tmp/db.sqlite3", NULL,
LATTUTIL_SQL_FLAG_LOG_QUERY); LATTUTIL_SQL_FLAG_LOG_QUERY);
if (sqlctx == NULL) { if (sqlctx == NULL) {
logp->ll_log_err(logp, -1, "Unable to create sqlite3 object"); logp->ll_log_err(logp, -1, "Unable to create sqlite3 object");
return (1); return (1);
} }
if (lattutil_log_sqlite_init(logp, sqlctx, "logtable") == false) {
fprintf(stderr, "[-] Could not init sqlite logger\n");
return (1);
}
logp->ll_log_info(logp, -1, "My info message");
query = lattutil_sqlite_prepare(sqlctx, query = lattutil_sqlite_prepare(sqlctx,
"CREATE TABLE IF NOT EXISTS test_table (" "CREATE TABLE IF NOT EXISTS test_table ("
" colname TEXT NOT NULL, " " colname TEXT NOT NULL, "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment