collectiveai-team

logger

0
0
# Install this skill:
npx skills add collectiveai-team/agent-skills --skill "logger"

Install specific skill from multi-skill repository

# Description

Logger setup and usage guidance. Use when logging is needed and no logger is present.

# SKILL.md


name: logger
description: Logger setup and usage guidance. Use when logging is needed and no logger is present.


Logger Skill

Create a logger instance if one does not exist.

Layout

logger/
    __init__.py
    logger.py

logger.py

import logging
from logging import Logger
from rich.console import Console
from rich.logging import RichHandler

_console = Console()


def get_logger(name: str | None = None, level: int = logging.INFO) -> Logger:
    logger = logging.getLogger(name)
    if not logger.handlers:
        handler = RichHandler(console=_console, rich_tracebacks=True, markup=True)
        formatter = logging.Formatter("%(message)s")
        handler.setFormatter(formatter)
        logger.addHandler(handler)
        logger.setLevel(level)
        logger.propagate = False
    return logger

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.