winston-fms-transport Build Status

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 /Users/luidelaparra/Documents/Development/winston-fms-transport
> nyc _mocha --recursive ./tests --timeout=30000
----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|

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.
  • chai-as-promised: Extends Chai with assertions about promises.
  • 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