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

本站现有博文320篇,共被浏览756734

本站已经建立2421天!

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