Files
fn_registry/python/functions/infra/get_logger.md
T
egutierrez 9fd0ca9cac feat: funciones Python infra y tipos Python (core, datascience, infra)
Infra: cache_to_file, cache_to_sqlite, http_download_file, http_get_json,
http_post_json, read_file_with_encoding, safe_extract_zip, scan_directory,
setup_logger, normalize_zip_filenames.
Tipos: 30+ tipos core (agent_action, context, task, message, parse_result...),
6 tipos datascience (entity_candidate, extraction_result...), 2 tipos infra.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 17:11:43 +02:00

37 lines
1.1 KiB
Markdown

---
name: get_logger
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def get_logger(name: str = 'app') -> logging.Logger"
description: "Devuelve un logger existente si ya tiene handlers, o lo crea con setup_logger. Util en modulos internos que no controlan la inicializacion del logger."
tags: [logging, logger, infra, utility]
uses_functions: [setup_logger_py_infra]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [logging]
tested: true
tests:
- "get_logger retorna logger configurado"
test_file_path: "python/functions/infra/setup_logger_test.py"
file_path: "python/functions/infra/setup_logger.py"
---
## Ejemplo
```python
from setup_logger import get_logger
# En cualquier modulo, sin preocuparse de si el logger ya fue inicializado
log = get_logger("mi_app")
log.info("Mensaje desde un modulo interno")
```
## Notas
Companion de `setup_logger`. Si el logger tiene handlers (ya fue configurado), lo devuelve tal cual. Si no, llama a `setup_logger` con valores por defecto (log_dir="logs"). Comparten el mismo archivo de implementacion.