winston-fms-transport
A transport to support logging via winston to FileMaker Server
Installation
This is a Node.js module available through the
npm registry. It can be installed using the
npm
or
yarn
command line tools.
npm install winston-fms-transport --save
Usage
'use strict';
const { connect } = require('marpat');
const { createLogger } = require('winston');
const environment = require('dotenv');
const varium = require('varium');
const { FilemakerTransport } = require('./index.js');
environment.config({ path: './tests/.env' });
varium(process.env, './tests/env.manifest');
connect('nedb://memory')
.then(db => {
const filemakerTransport = level =>
new FilemakerTransport({
application: process.env.APPLICATION,
server: process.env.SERVER,
user: process.env.USERNAME,
password: process.env.PASSWORD,
level: level,
infoField: 'info',
messageField: 'message',
layout: process.env.LAYOUT
});
const logger = createLogger({
transports: [filemakerTransport('silly')],
exitOnError: false
});
logger.emitErrs = true;
return logger;
})
.then(logger => logger.info('Message', { db: 'this is a message' }));
Tests
npm install
npm test
> winston-fms-transport@0.0.1 test /winston-fms-transport
> nyc _mocha --recursive ./tests --timeout=30000
.log()
✓ should be present
✓ should return true without a callback
✓ should return true with a callback
3 passing (25ms)
---------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------|----------|----------|----------|----------|-------------------|
All files | 84.85 | 0 | 57.14 | 84.85 | |
winston-fms-transport | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
winston-fms-transport/src | 83.87 | 0 | 57.14 | 83.87 | |
index.js | 100 | 100 | 100 | 100 | |
transport.model.js | 82.76 | 0 | 57.14 | 82.76 | 32,33,47,50,51 |
---------------------------|----------|----------|----------|----------|-------------------|
Dependencies
- fms-api-client: A FileMaker Data API client designed to allow easier interaction with a FileMaker application from a web environment.
- marpat: A class-based ES6 ODM for Mongo-like databases.
- transport: a hub for centralizing all your request handlers within your application
- winston: A multi-transport async logging library for Node.js
Dev Dependencies
- chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- coveralls: takes json-cov output into stdin and POSTs to coveralls.io
- dotenv: Loads environment variables from .env file
- eslint: An AST-based pattern checker for JavaScript.
- eslint-config-google: ESLint shareable config for the Google style
- eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier.
- eslint-plugin-prettier: Runs prettier as an eslint rule
- jsdocs: jsdocs
- minami: Clean and minimal JSDoc 3 Template / Theme
- mocha: simple, flexible, fun test framework
- mocha-lcov-reporter: LCOV reporter for Mocha
- nyc: the Istanbul command line interface
- package-json-to-readme: Generate a README.md from package.json contents
- prettier: Prettier is an opinionated code formatter
- varium: A strict parser and validator of environment config variables
License
MIT