Cassandra Logging-Adapter for slf4ts
This project forwards log events from datastax cassandra driver to slf4ts logger implementation.
It's s meant to be used with nodejs
.
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(...);