Collecting Information & Logging

Logging.

The Python SDK allows logging via the standard logging module, or via the LCB_LOGLEVEL environment variable.

import logging
import sys

import couchbase
from couchbase.cluster import Cluster, ClusterOptions
from couchbase_core.cluster import PasswordAuthenticator

logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
couchbase.enable_logging()

cluster = Cluster('couchbase://localhost/default',ClusterOptions(PasswordAuthenticator("default","password")))
bucket=cluster.bucket("fred")
coll=bucket.default_collection()
coll.upsert('key', ['value'])