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

本站现有博文322篇,共被浏览783934

本站已经建立2477天!

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