--- name: bash_log kind: function lang: bash domain: shell version: "1.0.0" purity: impure signature: "bash_log_init() -> void; success(msg: string) -> void; info(msg: string) -> void; warning(msg: string) -> void; error(msg: string) -> void; debug(msg: string) -> void; progress(msg: string) -> void" description: "Funciones de logging con colores para scripts bash. Incluye niveles success/info/warning/error/debug/progress con escritura a archivo de log." tags: [bash, log, logging, colors, terminal] uses_functions: [bash_colors_bash_shell] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [] params: - name: msg desc: "mensaje a mostrar y registrar en el archivo de log" output: "mensaje formateado con colores en stdout/stderr y registro con timestamp en archivo de log (ERROR_LOG_FILE)" tested: false tests: [] test_file_path: "" file_path: "bash/functions/shell/bash_log.sh" source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git" source_license: "MIT" source_file: "scripts/lib/common.sh" --- ## Ejemplo ```bash source bash/functions/shell/bash_log.sh bash_log_init success "Servicio iniciado correctamente" info "Procesando 42 registros..." warning "El puerto 8080 ya esta en uso" error "No se pudo conectar a la base de datos" debug "Valor de variable: $VAR" progress "Descargando imagen Docker..." ``` ## Notas Llama a `bash_log_init` una vez al inicio para configurar ERROR_LOG_FILE y DEBUG_MODE. Por defecto el log va a `/tmp/script-errors-YYYYMMDD.log`. La variable de entorno `DEBUG_MODE=1` activa los mensajes de debug a stderr y muestra timestamps en todos los logs. `error` escribe a stderr; el resto a stdout. Todos los niveles escriben al archivo de log independientemente de DEBUG_MODE. Fuente: sourcea `bash_colors.sh` automaticamente al cargarse.