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

本站现有博文327篇,共被浏览832761

本站已经建立2537天!

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