npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

winston-fms-transport

v1.1.1

Published

A transport to support logging via winston to FileMaker Server

Downloads

5

Readme

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
> [email protected] 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