# Logging

### enum CassLogLevel

*Values:*

### enumerator CASS_LOG_DISABLED

### enumerator CASS_LOG_CRITICAL

### enumerator CASS_LOG_ERROR

### enumerator CASS_LOG_WARN

### enumerator CASS_LOG_INFO

### enumerator CASS_LOG_DEBUG

### enumerator CASS_LOG_TRACE

### typedef void (\*CassLogCallback)(const [CassLogMessage](#_CPPv414CassLogMessage) \*message, void \*data)

A callback that’s used to handle logging.

#### SEE ALSO
[cass_log_set_callback()](#group___logging_1ga3e4b8d4216bfcb8b4361197e2eeead4c)

* **Param message:**
  **[in]** 
* **Param data:**
  **[in]** user defined data provided when the callback was registered.

### void cass_log_set_level([CassLogLevel](#_CPPv412CassLogLevel) log_level)

Sets the log level.

**Note:** Only setting the log level before any other interaction with the driver’s API is fully supported. Support for altering the log level during the driver’s operation is experimental, might misbehave (by displaying more or fewer logs than expected), and may be removed in the future.

**Default:** CASS_LOG_WARN

* **Parameters:**
  **log_level** – **[in]** 

### void cass_log_set_callback([CassLogCallback](#_CPPv415CassLogCallback) callback, void \*data)

Sets a callback for handling logging events.

**Note:** This needs to be done before any call that might log, such as any of the cass_cluster_\*() or cass_ssl_\*() functions.

**Default:** An internal callback that prints to stderr

* **Parameters:**
  * **data** – **[in]** An opaque data object passed to the callback. 
  * **callback** – **[in]** A callback that handles logging events. This is called in a separate thread so access to shared data must be synchronized. 

### void cass_log_get_callback_and_data([CassLogCallback](#_CPPv415CassLogCallback) \*callback_out, void \*\*data_out)

Analogous getter - useful for restoring logger to previous values.

* **Parameters:**
  * **callback_out** – **[out]** Current logging callback. Must point to a valid memory area. 
  * **data_out** – **[out]** Current Logger instance. Must point to a valid memory area. 

### const char \*cass_log_level_string([CassLogLevel](#_CPPv412CassLogLevel) log_level)

Gets the string for a log level.

* **Parameters:**
  **log_level** – **[in]** 
* **Returns:**
  A null-terminated string for the log level. Example: “ERROR”, “WARN”, “INFO”, etc. 

### struct CassLogMessage

 *#include <cassandra.h>*

A log message. 

### Public Members

### [cass_uint64_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.2/api/group.BasicTypes.md#_CPPv413cass_uint64_t) time_ms

The millisecond timestamp (since the Epoch) when the message was logged 

### [CassLogLevel](#_CPPv412CassLogLevel) severity

The severity of the log message 

### const char \*file

The file where the message was logged 

### int line

The line in the file where the message was logged 

### const char \*function

The function where the message was logged 

### char message[1024]

The message
