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

本站现有博文336篇,共被浏览947183

本站已经建立2657天!

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