EADST

Print Info in the Terminal and Save Logs in a File

Print Info in the Terminal and Save Logs in a File

import logging

log_name = "test"
logging.basicConfig(filename="{}.log".format(log_name), format='%(asctime)s %(message)s', filemode='w') 
sh = logging.StreamHandler()
logger=logging.getLogger() 
logger.setLevel(logging.DEBUG) 
logger.addHandler(sh)

logger.debug("Level lowest message") 
logger.info("Regular message") 
logger.warning("Warning message") 
logger.error("Error message") 
logger.critical("Fatal message") 

Reference

Python Logging

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
PDB LLM RAR Search 云服务器 git-lfs Knowledge Django MD5 YOLO Use Pillow 财报 强化学习 GPT4 Quantization Shortcut FlashAttention NLP tar Github Git Input Excel QWEN FP8 Permission Nginx 域名 mmap BeautifulSoup Template v2ray API网关 Domain BF16 Math SAM Plotly 递归学习法 CC Linux BTC OpenAI 证件照 FastAPI Markdown Baidu Michelin ModelScope Base64 长期记忆 HuggingFace CV 顶会 SQL Random Agent XGBoost GoogLeNet JSON VPN Logo API UNIX Python Paper Pickle 腾讯云 torchinfo FP32 WAN Clash Anaconda Streamlit Docker Image2Text Color C++ PDF Password 音频 FP16 Disk LLAMA CTC 多进程 ResNet-50 Mixtral Numpy Attention ms-swift EXCEL NameSilo NLTK LeetCode CUDA PyCharm FP64 VGG-16 Jev Claude HaggingFace TensorFlow logger Translation AI Qwen2.5 Ubuntu Review RGB Crawler Tracking Magnet icon hf Qwen2 Miniforge Sklearn Qwen Pandas 公式 Data Zip Windows Video 多线程 XML Transformers Bitcoin 飞书 Vim git SQLite printf Bipartite 算法题 Statistics Interview 版权 关于博主 Augmentation Quantize Tensor Distillation GIT CLAP 第一性原理 DeepStream Food Rebuttal Jetson Jupyter 报税 Llama OCR Conda 论文 IndexTTS2 uwsgi ChatGPT uWSGI CEIR News Card ONNX 自我改进 论文速读 TensorRT TSV Tiktoken Pytorch UI 净利润 Cloudreve Bin SVR scipy Google Firewall Ptyhon Datetime Dataset TTS Harness GPTQ CAM Vmess Breakpoint Hungarian Website Hilton Proxy LaTeX tqdm Freesound DeepSeek OpenCV Diagram PIP Bert Paddle Heatmap Safetensors VSCode Plate WebCrawler Hotel RL 图标 签证 Animate LoRA Algorithm 阿里云 diffusers transformers 图形思考法 继承 Gemma v0.dev PyTorch SPIE Web InvalidArgumentError GGML 搞笑 COCO CSV llama.cpp Land
站点统计

本站现有博文339篇,共被浏览995976次

本站已经建立2706天!

热门文章
文章归档
回到顶部