slf4ts-cassandra-log-adapter
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

slf4ts-cassandra-log-adapter

Cassandra Logging-Adapter for slf4ts

NPM Version License Dependencies Status

This project forwards log events from datastax cassandra driver to slf4ts logger implementation.
It's s meant to be used with nodejs.

Usage

import { ILoggerInstance, LoggerFactory } from "slf4ts-api";
 
// create an instance of Client
const client = new Client({ contactPoints: ["127.0.0.1:9042"] });
 
// Create an instance of the logging adapter for each client
// creates/uses a logger with group "cassandra" and the keyspace of the client as name (empty string if not configured) 
new CassandraLogAdapter(client);
 
// Create an instance of the logging adapter with a pre-created logger instance
const logger: ILoggerInstance = LoggerFactory.getLogger("my-cassandra");
new CassandraLogAdapter(client, logger);
 
// use the client as usual
client.connect(() => {
    ...
});
 
// access the underlying logger instance
const logger: ILoggerInstance = LoggerFactory.getLogger("cassandra", client.keyspace);
logger.setLogLevel(...);

License

MIT

/slf4ts-cassandra-log-adapter/

    Package Sidebar

    Install

    npm i slf4ts-cassandra-log-adapter

    Weekly Downloads

    1

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    22.4 kB

    Total Files

    12

    Last publish

    Collaborators

    • rstiller