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

本站现有博文321篇,共被浏览775415

本站已经建立2466天!

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