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

本站现有博文338篇,共被浏览966591次

本站已经建立2679天!

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