You are viewing the documentation for a prerelease version.

View Latest

Collecting Information & Logging

Logging.

These pages cover the Beta release of the Couchbase Python SDK. The API interface is stable, but could change for bug fixes during the Beta process. New features are likely to be added.

Documentation is incomplete, subject to change, and could contain broken links.

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'])