Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FluentdLogger

Logger that dumps execution logs to Fluentd service.

Fluentd is a popular logging service that is often used together with Kubernetes container orchestrator.

Authentication is not supported in this version.

Configuration parameters

  • level: maximum log level to capture
  • source: source (context) name
  • connection(s):
    • discovery_key: (optional) a key to retrieve the connection from IDiscovery
    • protocol: connection protocol: http or https
    • host: host name or IP address
    • port: port number
    • uri: resource URI or connection string with all parameters in it
  • options:
    • interval: interval in milliseconds to save log messages (default: 10 seconds)
    • max_cache_size: maximum number of messages stored in this cache (default: 100)
    • reconnect: reconnect timeout in milliseconds (default: 60 sec)
    • timeout: invocation timeout in milliseconds (default: 30 sec)

References

  • *:context-info:*:*:1.0 (optional) ContextInfo to detect the context id and specify counters source
  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection

Example

let logger = new FluentdLogger();
logger.configure(ConfigParams.fromTuples(
    "connection.protocol", "http",
    "connection.host", "localhost",
    "connection.port", 24224
));

logger.open("123", (err) => {
    ...
});

logger.error("123", ex, "Error occured: %s", ex.message);
logger.debug("123", "Everything is OK.");

Hierarchy

Implements

  • any
  • any

Index

Constructors

constructor

  • Creates a new instance of the logger.

    Returns FluentdLogger

Methods

close

  • close(correlationId: string, callback: function): void
  • Closes component and frees used resources.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

isOpen

  • isOpen(): boolean
  • Checks if the component is opened.

    Returns boolean

    true if the component has been opened and false otherwise.

open

  • open(correlationId: string, callback: function): void
  • Opens the component.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

Protected save

  • save(messages: LogMessage[], callback: function): void
  • Saves log messages from the cache.

    Parameters

    • messages: LogMessage[]

      a list with log messages

    • callback: function

      callback function that receives error or null for success.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

setReferences

  • setReferences(references: IReferences): void
  • Sets references to dependent components.

    Parameters

    • references: IReferences

      references to locate the component dependencies.

    Returns void

Generated using TypeDoc