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

本站现有博文311篇,共被浏览742228

本站已经建立2381天!

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