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

本站现有博文327篇,共被浏览826028

本站已经建立2532天!

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