neurocore.logging.setup

NeuroCore structured logging — configures structlog for the entire application.

Reuses the same pattern as NeuroWeave: structlog with console (colored, dev) and JSON (machine-parseable, production) modes. Adds optional file handler support for persistent log output.

Usage:

from neurocore.logging import configure_logging, get_logger from neurocore.config import load_config

config = load_config() configure_logging(config)

log = get_logger(“my-component”) log.info(“started”, version=”0.1.0”)

Functions

configure_logging(→ None)

Configure structlog and stdlib logging from NeuroCoreConfig.

get_logger(→ structlog.stdlib.BoundLogger)

Get a structlog logger, optionally bound to a component name.

reset_logging(→ None)

Reset logging configuration. Primarily for testing.

Module Contents

neurocore.logging.setup.configure_logging(config: neurocore.config.schema.NeuroCoreConfig) None[source]

Configure structlog and stdlib logging from NeuroCoreConfig.

Call once at startup. After this, any module can do:

from neurocore.logging import get_logger log = get_logger(“skills”) log.info(“skill.loaded”, name=”neuroweave”, version=”0.1.0”)

Parameters:

config – NeuroCoreConfig with logging.level, logging.format, logging.file.

neurocore.logging.setup.get_logger(name: str | None = None) structlog.stdlib.BoundLogger[source]

Get a structlog logger, optionally bound to a component name.

Parameters:

name – Component name (e.g. “skills”, “config”, “runtime”). Added as ‘component’ key in log events.

Returns:

A bound structlog logger.

neurocore.logging.setup.reset_logging() None[source]

Reset logging configuration. Primarily for testing.