Coder Social home page Coder Social logo

feathers-logger's Introduction

feathers-logger

Build Status

Unmaintained: This module is no longer maintained.

Logging mixin for a Feathers app.

Migrating

As of October 2019 this module is no longer maintained since it contained only a few lines of redundant code. Applications generated with the latest @feathersjs/cli already export a separate logger.js file which sets up a normal Winston Logger that can be directly required for logging purposes. If you would like logging capabilities available on the application object add

app.logger = logger;

At the end of your src/app.js (or src/app.ts) file.

Getting Started

Install the module with: npm install feathers-logger --save

var feathers = require('feathers');
var logger = require('feathers-logger');

var app = feathers()
  .configure(logger())
  .use('/users', userService);

Documentation

Feathers-logger is just a simple wrapper for any logger so that you can conveniently do app.log(). There are 5 methods provided for you to use:

  • app.log()
  • app.info()
  • app.warn()
  • app.error()
  • app.debug()

They have graceful fallback to the core nodejs console methods.

Vanilla Usage

var feathers = require('feathers');
var logger = require('feathers-logger');
var memory = require('feathers-memory');

var app = feathers()
    .configure(logger())
    .use('/users', memory);

app.log('Server Started');

Using With Winston

var winston = require('winston');
var feathers = require('feathers');
var logger = require('feathers-logger');
var memory = require('feathers-memory');

var app = feathers()
    .configure(logger(winston))
    .use('/users', memory);

app.log('Server Started');

Using With Morgan

var morgan = require('morgan');
var feathers = require('feathers');
var logger = require('feathers-logger');
var memory = require('feathers-memory');

var app = feathers()
    .configure(logger(morgan({
      format: 'dev'
    })))
    .use('/users', memory);

app.log('Server Started');

Examples

See example directory.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using the npm test.

Release History

0.2.0

  • cleans up a bunch of stuff
  • makes plugin consistent with other plugins
  • upgrades to latest uberproto
  • removes feathers as peer dependency
  • removes gulp from the equation
  • tests against feathers 2

0.1.0

  • Initial release
  • Vanilla logging support
  • Added documentation & example
  • Support for Winston logger
  • Support for Morgan logger

License

Copyright (c) 2018

Licensed under the MIT license.

feathers-logger's People

Contributors

beeplin avatar chappy84 avatar corymsmith avatar daffl avatar ekryski avatar greenkeeper[bot] avatar yuriydobryanskyyempeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

feathers-logger's Issues

An in-range update of mocha is breaking the build 🚨

The devDependency mocha was updated from 6.0.2 to 6.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v6.1.0

6.1.0 / 2019-04-07

πŸ”’ Security Fixes

  • #3845: Update dependency "js-yaml" to v3.13.0 per npm security advisory (@plroebuck)

πŸŽ‰ Enhancements

  • #3766: Make reporter constructor support optional options parameter (@plroebuck)
  • #3760: Add support for config files with .jsonc extension (@sstephant)

πŸ“  Deprecations

These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:

πŸ› Fixes

  • #3829: Use cwd-relative pathname to load config file (@plroebuck)
  • #3745: Fix async calls of this.skip() in "before each" hooks (@juergba)
  • #3669: Enable --allow-uncaught for uncaught exceptions thrown inside hooks (@givanse)

and some regressions:

πŸ“– Documentation

πŸ”© Other

  • #3830: Replace dependency "findup-sync" with "find-up" for faster startup (@cspotcode)
  • #3799: Update devDependencies to fix many npm vulnerabilities (@XhmikosR)
Commits

The new version differs by 28 commits.

  • f4fc95a Release v6.1.0
  • bd29dbd update CHANGELOG for v6.1.0 [ci skip]
  • aaf2b72 Use cwd-relative pathname to load config file (#3829)
  • b079d24 upgrade deps as per npm audit fix; closes #3854
  • e87c689 Deprecate this.skip() for "after all" hooks (#3719)
  • 81cfa90 Copy Suite property "root" when cloning; closes #3847 (#3848)
  • 8aa2fc4 Fix issue 3714, hide pound icon showing on hover header on docs page (#3850)
  • 586bf78 Update JS-YAML to address security issue (#3845)
  • d1024a3 Update doc examples "tests.html" (#3811)
  • 1d570e0 Delete "/docs/example/chai.js"
  • ade8b90 runner.js: "self.test" undefined in Browser (#3835)
  • 0098147 Replace findup-sync with find-up for faster startup (#3830)
  • d5ba121 Remove "package" flag from sample config file because it can only be passes as CLI arg (#3793)
  • a3089ad update package-lock
  • 75430ec Upgrade yargs-parser dependency to avoid loading 2 copies of yargs

There are 28 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add browser support

Probably just need to make sure that we have fallback to cross browser compatible console methods for:

  • log()
  • info()
  • warn()
  • error()

Add Bunyan Support

Drop in support for Bunyan over and above Winston and Morgan

var bunyan = require('bunyan');
var feathers = require('feathers');
var logger = require('feathers-logger');
var memory = require('feathers-memory');

var app = feathers()
    .configure(logger(bunyan({
      ...args
    })))
    .use('/users', memory);

app.log('Server Started');

Usage with Winston

The docs explain how to use feathers-logger with winston:

var winston = require('winston');
var feathers = require('feathers');
var logger = require('feathers-logger');
var memory = require('feathers-memory');

var app = feathers()
    .configure(logger(winston))
    .use('/users', memory);

app.log('Server Started');

But Winston is normally instantiated and configured first, like so:

const winston = require('winston');

const winstonLogger = new winston.Logger();

// Add transport to winston logger here

How do I add a transport to the logger if I pass the winston function as per the example instructions?

An in-range update of @feathersjs/feathers is breaking the build 🚨

The devDependency @feathersjs/feathers was updated from 4.3.0 to 4.3.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@feathersjs/feathers is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 6 commits.

  • 64c73ba v4.3.1
  • 65637ec fix: Use long-timeout for JWT expiration timers (#1552)
  • ed9e934 fix: Fix regression in transport commons (#1551)
  • 8d4410a chore: Update grant-profile (#1549)
  • ef16d29 fix: Omit standard protocol ports from the default hostname (#1543)
  • 19259dd Update version and changelog

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Support for TypeScript with Feathers 4

I want to include your package in a new Feathers 4 app using typescript but could not get it done.

I made the following middleware but had to ignore a typescript error because definitions are missing.

import winston from 'winston';
// @ts-ignore
import logger from 'feathers-logger';
import { Application } from '../declarations';

export default function(app: Application) {
    app.configure(logger(winston));
}

But also every time I use app.debug() or any of the other methods I also has to ignore these lines in TS.

How to get it done correctly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.