{"id":43983,"library":"sqllog","title":"sqlLog","description":"sqlLog (v0.4.2) is a lightweight library that adds a simple logging table to an SQL database, built on top of the davesql package. It provides automatic creation of a 'log' table with fields for event name, error, JSON data, and timestamp. Designed for quick integration, it offers methods to append events and retrieve recent operations. Release cadence is low; last update 2016. Differentiator: minimal setup, ideal for small apps needing basic SQL logging without a full ORM.","status":"maintenance","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/scripting/xxx","tags":["javascript"],"install":[{"cmd":"npm install sqllog","lang":"bash","label":"npm"},{"cmd":"yarn add sqllog","lang":"bash","label":"yarn"},{"cmd":"pnpm add sqllog","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for SQL operations; sqlLog extends davesql.","package":"davesql","optional":false}],"imports":[{"note":"ESM-only; no CommonJS support.","wrong":"const sqlLog = require('sqllog')","symbol":"default","correct":"import sqlLog from 'sqllog'"},{"note":"Named export for appending events.","wrong":"","symbol":"append","correct":"import { append } from 'sqllog'"},{"note":"recent is a named function, not a method of default export.","wrong":"import sqlLog from 'sqllog'; sqlLog.recent","symbol":"recent","correct":"import { recent } from 'sqllog'"}],"quickstart":{"code":"import davesql from 'davesql';\nimport sqlLog from 'sqllog';\n\n// create a davesql instance\nconst db = new davesql.DaveSql();\nconst config = { host: 'localhost', user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'test' };\ndb.connect(config);\n\n// initialize sqlLog\nsqlLog.init(db);\n// append a log entry\nsqlLog.append('user_login', { user: 'alice' });\n// get recent events\nconst recent = sqlLog.recent(10);\nconsole.log(recent);","lang":"javascript","description":"Initialize davesql, connect to MySQL, then use sqlLog to log events and retrieve recent entries."},"warnings":[{"fix":"Ensure davesql is properly installed and connected before calling sqlLog.init().","message":"davesql package must be initialized before using sqlLog; sqlLog.init(db) will fail if db is not a valid davesql instance.","severity":"breaking","affected_versions":">=0.0"},{"fix":"Manually create the log table with the expected schema before using sqlLog, or drop the existing table and let sqlLog recreate it.","message":"The log table is automatically created by sqlLog.init() if it doesn't exist; but if the table already has a different schema, init() may fail or cause errors.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Consider evaluating if the package is still suitable for production use; check for alternative logging libraries.","message":"Current version (0.4.2) is old and may not be actively maintained; there are potential security fixes in newer versions of davesql that may not be reflected.","severity":"deprecated","affected_versions":"<=0.4.2"},{"fix":"Always pass an object for eventData, e.g., { message: 'some string' }.","message":"The append function expects eventData as an object; passing a string may lead to unexpected behavior.","severity":"gotcha","affected_versions":">=0.0"}],"env_vars":null,"search_vec":"'2016':63 'add':9 'app':70 'append':51 'automat':27 'basic':72 'built':18 'cadenc':58 'creation':28 'data':40 'databas':17 'davesql':23 'design':43 'differenti':64 'error':38 'event':36,52 'field':34 'full':77 'ideal':67 'integr':46 'javascript':79 'json':39 'last':61 'librari':7 'lightweight':6 'log':12,31,74 'low':60 'method':49 'minim':65 'name':37 'need':71 'offer':48 'oper':56 'orm':78 'packag':24 'provid':26 'quick':45 'recent':55 'releas':57 'retriev':54 'setup':66 'simpl':11 'small':69 'sql':16,73 'sqllog':1,2 'tabl':13,32 'timestamp':42 'top':20 'updat':62 'v0.4.2':3 'without':75","created_at":"2026-06-05T17:02:25.074182+00:00","updated_at":"2026-06-05T17:02:25.074182+00:00","problems":[{"fix":"Use import sqlLog from 'sqllog' and then call sqlLog.init().","cause":"Importing the default export incorrectly; sqlLog.default may be needed.","error":"TypeError: sqlLog.init is not a function"},{"fix":"Run 'npm install davesql' in your project.","cause":"davesql is not installed.","error":"Cannot find module 'davesql'"},{"fix":"Create the database first: CREATE DATABASE test;","cause":"The specified database does not exist.","error":"ER_BAD_DB_ERROR: Unknown database 'test'"},{"fix":"Drop the existing log table or ensure it matches the expected schema.","cause":"sqlLog.init() tries to create the log table but it already exists with possibly different schema.","error":"Table 'log' already exists"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/scripting/xxx#readme","github":"https://github.com/scripting/xxx","docs":null,"changelog":null,"pypi":null,"npm":"sqllog","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}