Skip to content

Latest commit

 

History

History

slf4ts-cassandra-log-adapter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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