firebase-winston

0.2.0 • Public • Published

firebase-winston

npm Travis Codecov

A Firebase transport for Winston

Usage

const winston = require('winston');
const admin = require('firebase-admin');
const FirebaseLogger = require('firebase-winston');
 
const db = admin.database();
 
winston.add(FirebaseLogger, { ref: db.ref('logs') });
 
winston.log('info', 'This is a message', { anything: 'This is metadata' })

Firebase Realtime Database

Options

Required is that you set the ref option when adding a transport. Firebase needs a key to store an object. If no key option is set, the current timestamp will be used. If you do set the key option, all your logs that use the FirebaseLogger have to include a key/value in the metadata with that name.

winston.add(FirebaseLogger, {
    ref: db.ref('logging'),
    key: 'my_key'
});
 
winston.log('error', 'Something went wrong', { anything: 'This is metadata', my_key: 123 })

Firebase Realtime Database

/firebase-winston/

    Package Sidebar

    Install

    npm i firebase-winston

    Weekly Downloads

    1

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    150 kB

    Total Files

    8

    Last publish

    Collaborators

    • brams-dev