Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-fms-transport

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-fms-transport

A transport to support logging via winston to FileMaker Server

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

winston-fms-transport

Build StatusCoverage StatusKnown VulnerabilitiesGitHub issues Github commits (since latest release) GitHub license

A transport to support logging via winston to FileMaker Server

Installation

npm install --save winston-fms-transport

Usage

This is a winston log transport designed to send logs to a FileMaker file via the Data API. This transport uses fms-api-client and marpat. To use this transport you must first call marpat's connect function. Marpat is designed to allow the use of multiple datastores with the focus on encrypted file storage and project flexibility. Once connected to marpat, a FileMaker transport will be created and used to transfer logs. Note that if connect is not called, this transport will log a message to the console but not throw an error.

connect('nedb://memory')
  .then(db => {

Excerpt from ./example.js

A transport is defined with the following properties. Note the infoField, messageField, and layout properties. The layout property specifices the layout to use in Filemaker when creating log records. The infoField will be used for the log data and the messageField will be used for the log message. All other properties conform the the properties required by the fms-api-client.

    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
      });

Excerpt from ./example.js

Once a transport is created it can be added to a logger instance like any other transport.

    const logger = createLogger({
      transports: [filemakerTransport('info')],
      exitOnError: false
    });

Excerpt from ./example.js

Once defined, the logger can be called from within the node application and logs of the appropriate level will be sent to FileMaker.

    logger.silly('Message', { db: 'this is a message' });

Excerpt from ./example.js

Tests

npm install
npm test
> winston-fms-transport@1.0.2 test /Users/luidelaparra/Documents/Development/winston-fms-transport
> nyc _mocha --recursive ./tests --timeout=30000



  Agent Tests
    ✓ should have a log function
    ✓ should should not throw an error if connect has not been called

  Client Test
    ✓ should reject if it can not send a message
    ✓ should reuse the same client to try and send a message

  Log Test
    ✓ should be able send a log to FileMaker
    ✓ should be able send multiple messages on the same client

  Transport Tests
    ✓ should have a log function
    ✓ should return true without a callback
    ✓ should return true with a callback (271ms)
    ✓ should reject and log an error if there is an error (105ms)


  10 passing (454ms)

---------------------------|----------|----------|----------|----------|-------------------|
File                       |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
---------------------------|----------|----------|----------|----------|-------------------|
All files                  |      100 |    83.33 |      100 |      100 |                   |
 winston-fms-transport     |      100 |      100 |      100 |      100 |                   |
  index.js                 |      100 |      100 |      100 |      100 |                   |
 winston-fms-transport/src |      100 |    83.33 |      100 |      100 |                   |
  index.js                 |      100 |      100 |      100 |      100 |                   |
  transport.model.js       |      100 |    83.33 |      100 |      100 |                52 |
---------------------------|----------|----------|----------|----------|-------------------|

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.
  • winston: A logger for just about everything.

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
  • jsdoc: An API documentation generator for JavaScript.
  • minami: Clean and minimal JSDoc 3 Template / Theme
  • mos: A pluggable module that injects content into your markdown files via hidden JavaScript snippets
  • mos-plugin-dependencies: A mos plugin that creates dependencies sections
  • mos-plugin-execute: Mos plugin to inline a process output
  • mos-plugin-license: A mos plugin for generating a license section
  • mocha: simple, flexible, fun test framework
  • mocha-lcov-reporter: LCOV reporter for Mocha
  • nyc: the Istanbul command line interface
  • prettier: Prettier is an opinionated code formatter
  • varium: A strict parser and validator of environment config variables

License

MIT © Lui de la Parra

Keywords

FAQs

Package last updated on 19 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc