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

本站现有博文332篇,共被浏览896821

本站已经建立2597天!

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