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

本站现有博文337篇,共被浏览961521次

本站已经建立2673天!

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