Skip to content
femtologging
Menu

Guides

Migrate existing logging code

Check the supported API first, then adopt the structured logging changes in 0.2.0.

0.2.0 surface · 0.2.0-beta1 forthcoming

Account for the 0.1.0 names

Use the FemtoLogger and Femto*Handler names for the runtime classes and get_logger for registered loggers. The compatibility alias getLogger is available. Consult the 0.1.0 migration guide for earlier renames.

Prepare for the 0.2.0 changes

BasicConfig now has slots. Assign only its five declared fields; auxiliary attributes raise AttributeError. Move unrelated caller state out of the configuration object.

Named logger methods support inline extra fields and scoped context propagation. Inline values win on collision. Context is thread-local, so do not carry it across awaits. exception() still lacks an extra parameter.

Reuse a handler through the adapter

StdlibHandlerAdapter lets an existing logging.Handler receive translated records. It does not unify the two logging managers or restore unsupported call-site metadata and lazy formatting.

Run the complete adapter example, then check compatibility and limits before changing application-wide logging.