fgm / filog

A fine logger package for Meteor.JS applications (client + server)
GNU General Public License v3.0
18 stars 6 forks source link
log logger logging meteor meteorjs mongodb psr-3 syslog typescript

FiLog: a Meteor 1.9 logging package

Build Status CodeCov Test Coverage codebeat badge Known Vulnerabilities FOSSA Status

FiLog is a highly configurable isomorphic logger for Meteor applications, supporting configurable logging strategies and custom processing and log sending destinations.

Out of the box, it can log to the console (browser, server), the Meteor database, any Syslog server, and includes a "tee" logger to send to multiple destinations. On the browser, it can log to its own Meteor server over DDP, or to a centralized FiLog log aggregation server over HTTP.

FiLog is based upon low-level NPM packages::

Read the Documentation.

Configuration and usage

Main ideas:

Typical use case:

Format note

These two timestamps are here to alleviate any issue resulting from a clock difference between clients and servers.

Any sender can add extra keys to the context, under the timestamp main key, to enable timing diagnostics.

Running tests

The module contains tests. Some of them are unit tests and need nothing special to run, while others are currently implemented as integration tests and assume you have a working harness project using Filog, exposed on http://localhost:3000.

Start by compiling the package:

Then you can run :

To run integration tests, you need to run the provided test_harness project in one terminal, and the tests in another one. Alternatively, you could also roll your own bespoke test harness, which will need to have Filog configured.

Example server-side code in the test_harness/ directory

This file is needed to allow Filog to operate on the /logger URL: otherwise, Meteor will handle it natively and return a 200 with the default application page, failing the integration tests.

Terminal 1

cd (filog_dir)/test_harness
meteor yarn
meteor run --port 3100

This example uses port 3100 to avoid conflicting with existing applications on the default Meteor port (3000). To use another port, be sure to change it in __tests__/integration/harness.ts too.

Terminal 2

cd (filog_dir)
meteor yarn
meteor yarn run compile
meteor yarn run test
meteor yarn run cover

TIP Reading the .travis.yml file can be useful too.

License

FOSSA Status