JSPM

@reallyuseful/logger-transport-gelf

1.0.0-alpha.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q17922F
    • License MIT

    A logging transport for GELF and Graylog

    Package Exports

    • @reallyuseful/logger-transport-gelf

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@reallyuseful/logger-transport-gelf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @reallyuseful/logger-transport-gelf

    Logging transport for GELF/Graylog

    This is a logging transport for @reallyuseful/logger.

    It logs to a GELF server (the protocol used by Graylog).

    const { Logger, ConsoleTransport } = require('@reallyuseful/logger');
    const { GelfTransport } = require('@reallyuseful/logger-transport-gelf');
    
    // log to Graylog and to the console
    const gelfTransport = new GelfTransport({ appName: 'myApp' });
    const consoleTransport = new ConsoleTransport();
    
    const myLogger = new Logger([gelfTransport, consoleTransport]);

    Options for GelfTransport

    GelfTransport can be customized with the following options:

    Options for connecting to the GELF/Gryalog server

    • host (string): the GELF or Graylog host (default: localhost)
    • port (number): TCP or UDP port number (default: 12201)
    • protocol (udp, tcp, or tcp-tls): whether to use UDP, TCP, or TCP with TLS encryption (default: udp)
    • ipVersion (4 or 6): must be set if your GELF host is on IPv6 (default: 4)
    • tcpTimeout (number): if using a tcp protocol, the timeout in milliseconds (default: 4000 milliseconds)
    • caCert (string): if using tcp-tls and a self-signed certificate, the certificate of the CA that issued it, in PEM format

    Options that identify your app

    • source (string): your app’s hostname (default: os.hostname())
    • appName (string): your app’s name, passed as the appName value to GELF
    • appVersion (string): your app’s version number, passed as the appVersion value to GELF
    • env (string): the environment (such as "development" or "production") in which your app is running (default: the value of the NODE_ENV environment variable)

    Options for modifying messages to be logged

    • transform (function): an optional function that can modify messages just before they are sent to GELF. Receives (message, meta) as input and must return an object { message, meta } with the modified values.

    Other options

    • minimumSeverity (Level): if specified, messages lower than this severity will not be logged to this transport