Registry / database / errsole-mysql

errsole-mysql

JSON →
library3.0.0jsnpmunverified

errsole-mysql is the official MySQL storage backend for Errsole, an open-source Node.js logger with a built-in log viewer. Version 3.0.0 depends on errsole and the mysql2 package. It enables direct logging to MySQL databases, offering a seamless integration for projects already using MySQL. Unlike generic loggers, Errsole provides a web-based interface to filter, search, and visualize logs. The plugin follows the same release cadence as Errsole core, with updates focused on compatibility and performance.

npm install errsole-mysql
INSTALL
IMPORT
SIG · ERRSOLE-MYSQL
E
errsole-mysql
databasejavascriptv3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createErrsoleMySQL
import { createErrsoleMySQL } from 'errsole-mysql'
const createErrsoleMySQL = require('errsole-mysql').createErrsoleMySQL
ESM-only since v3; CommonJS require() does not auto-unwrap named exports.
ErrsoleMySQL
import { ErrsoleMySQL } from 'errsole-mysql'
import ErrsoleMySQL from 'errsole-mysql'
Exported as named export, not default. For TypeScript types, use 'import type { ErrsoleMySQL }'.
default
import mysql from 'errsole-mysql'
const mysql = require('errsole-mysql')
A default export is available but deprecated; prefer named exports.

Initializes Errsole with MySQL storage using environment variables for configuration, then logs a sample info and error message.

import errsole from 'errsole'; import { createErrsoleMySQL } from 'errsole-mysql'; const logger = errsole.init({ storage: createErrsoleMySQL({ host: process.env.MYSQL_HOST ?? 'localhost', port: parseInt(process.env.MYSQL_PORT ?? '3306', 10), user: process.env.MYSQL_USER ?? 'root', password: process.env.MYSQL_PASSWORD ?? '', database: process.env.MYSQL_DATABASE ?? 'logs' }) }); logger.info('Application started'); logger.error('An error occurred', { error: new Error('test') }); // Access web interface at http://localhost:8001 (default Errsole port)
Debug
Known issues
breakingerrsole-mysql v3 drops support for Node.js < 14 and requires ESM imports.
fix
Upgrade Node.js to 14+ and use import syntax instead of require().
affects: >=3.0.0
breakingConfiguration format changed in v3: options object keys now use camelCase (e.g., 'host' instead of 'HOST').
fix
Update storage configuration to use camelCase property names.
affects: >=3.0.0
deprecatedThe default export is deprecated in favor of named exports (createErrsoleMySQL, ErrsoleMySQL).
fix
Use named imports: import { createErrsoleMySQL } from 'errsole-mysql'.
affects: >=3.0.0
gotchaTable names are auto-generated; if you have custom table prefixes, set them via the 'tablePrefix' option during initialization.
fix
Pass '{ tablePrefix: 'myapp_' }' in the configuration object to avoid collisions.
affects: >=2.0.0
gotchaThe plugin does not create the database automatically; the specified database must exist beforehand.
fix
Create the database manually (e.g., CREATE DATABASE logs) before starting the application.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'errsole-mysql'
Package not installed or imported incorrectly in a CommonJS project.
fix
Install the package: npm install errsole-mysql. For v3+, use ESM imports or set type: 'module' in package.json.
errsole is not a function
Default import of errsole is used instead of named import; errsole-mysql v3 expects named exports.
fix
Use import { createErrsoleMySQL } from 'errsole-mysql' instead of import mysql from 'errsole-mysql'.
ER_ACCESS_DENIED_ERROR: Access denied for user 'user'@'host' (using password: YES)
Invalid MySQL credentials provided in the configuration.
fix
Verify MYSQL_USER, MYSQL_PASSWORD, and host permissions. Consider using environment variables.
Error: connect ECONNREFUSED 127.0.0.1:3306
MySQL server is not running or not accessible at the configured host/port.
fix
Start MySQL service or update the host/port in the configuration.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
errsolerequiredCore logger framework; this plugin extends Errsole with MySQL storage.
mysql2requiredMySQL client for Node.js; used to connect and query the database.
Agent activity
8 hits · last 30 days
node
8
Resources
errsole-mysql — npm install errsole-mysql · libregistry