winston-sqlserver

A SQL Server transport for winston

Usage no npm install needed!

<script type="module">
  import winstonSqlserver from 'https://cdn.skypack.dev/winston-sqlserver';
</script>

README

winston-sqlserver

This module allows you to log your winston messages to a SQL Server database using node-sqlserver.

Installation

  1. Follow the steps in How to Access Windows Azure SQL Database from Node.js to get the node-sqlserver package installed.
  2. Run npm install winston-sqlserver.
  3. In the database you will use for logging, execute CreateLogTable.sql to create a table of the form necessary for this package.

Usage

var winston = require('winston');

// Requiring `winston-sqlserver` will expose `winston.transports.SQLServer`
require('winston-sqlserver');

winston.add(winston.transports.SQLServer, options);

Testing

Unit tests can be found in the test directory. They require mocha and should to be installed via npm. Testing can be configured with variables in test-config.js. The default settings assume SQL Express has been installed and CreateLogTable.sql has been run in a database called winston.