Skip to content
Back to skills

Notebook.Fix Logging

ASecurity

Use idiom for controlling logging in Jupyter notebooks

  • 158 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
toolsgo

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add gpsaggese/helpers --skill notebook.fix_logging --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Notebook.Fix Logging?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Notebook.Fix Logging
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gpsaggese-notebook-fix-logging/badge)](https://www.skillsdirectory.com/skills/gpsaggese-notebook-fix-logging)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Use idiom for controlling logging in Jupyter notebooks
model: haiku
---

# Goal
- Implement the instructions in `.claude/skills/notebook.rules.md` under
  `## Use Standard Template Structure`

- Use the structure from `.claude/templates/notebook.template.py` for notebook
  initialization

- Use `display`

- The local utility `*_utils.py` should have a function like
  ```
  import helpers.hnotebook as hnotebo

  def init_loggers(notebook_log: logging.Logger) -> None:
      """
      Wire the notebook logger into the utils logger.

      :param notebook_log: logger owned by the notebook
      """
      hnotebo.init_loggers(notebook_log, utils_log=_LOG)
  ```
  - `hnotebo.init_loggers()` already calls `config_notebook()`, initializes
    `hdbg` at INFO level, and redirects the notebook and utils loggers to
    print
  - For a third-party logger (e.g., `causalml`), redirect it inside
    `init_loggers()` with `hnotebo.set_logger_to_print()`:
    ```
    hnotebo.set_logger_to_print(logging.getLogger("causalml"))
    ```

- The last setup cell in the notebook calls `utils.init_loggers(_LOG)`, not
  `logging.basicConfig()` or `hdbg.init_logger()`

# Workflow

## Sync Notebook
- At the end, sync the paired `.py` file with Jupytext following the conventions
  in `# Code Architecture and Responsibility` -> `## Utilities vs. Notebook
  Responsibilities` in `.claude/skills/notebook.rules.md`

# Conventions
- Always follow the conventions and guidelines in
  `.claude/skills/notebook.rules.md`

# Verification
- [ ] Confirm the notebook init cell matches
      `.claude/templates/notebook.template.py`
- [ ] Confirm `utils.init_loggers()` is called and log messages print in the
      notebook
- [ ] Confirm the `.ipynb` and paired `.py` file are in sync via Jupytext

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.