Skip to content

Examples Overview

Pretty Loguru provides comprehensive examples to help you quickly get started and master various features. All examples include complete Python code and detailed bilingual documentation.

🎯 Learning Path

1. Beginner Start (5 minutes)

Recommended Sequence: 01_basics → 02_visual → 03_presets

  • 01_basics - Core Features (3-minute Quick Start)

    • Basic logger creation and usage
    • Console vs file output
    • Target-oriented logging methods
    • 中文版本
  • 02_visual - Visual Features Showcase

    • Block formatting and ASCII art
    • Rich components and table display
    • Monitoring dashboard examples
    • 中文版本
  • 03_presets - Preset Configurations and File Management

    • Rotation strategy selection
    • Environment configuration management
    • Production environment best practices
    • 中文版本

2. Practical Application (15 minutes)

Recommended Sequence: 04_fastapi → 05_production

  • 04_fastapi - Real Web Application Examples

    • FastAPI deep integration
    • Middleware automatic logging
    • Microservice dependency injection
    • 中文版本
  • 05_production - Production Environment Best Practices

    • Multi-environment configuration management
    • Performance monitoring and error tracking
    • Security compliance requirements
    • 中文版本

3. Advanced Exploration (30 minutes)

Suitable for: Developers who need deep customization features

  • 06_advanced - Advanced Features and Direct Library Access
    • Advanced API module usage
    • Custom extension development
    • Event system and protocols
    • 中文版本

🚀 Quick Start

  1. Clone examples:

    bash
    git clone https://github.com/JonesHong/pretty-loguru.git
    cd pretty-loguru/examples
  2. Run first example:

    bash
    cd 01_basics
    python simple_usage.py
  3. Check generated logs:

    bash
    ls ./logs/
    cat ./logs/*.log

📚 Example Features

Fully Runnable

  • All examples are complete Python programs
  • Include necessary dependencies and configurations
  • Provide detailed running instructions

Progressive Learning

  • Learning path from simple to complex
  • Each example has clear learning objectives
  • Provide real-world application scenarios

Multilingual Support

  • Each example provides bilingual documentation
  • Clear and understandable code comments
  • Suitable for developers with different language backgrounds

Practical Oriented

  • Designed based on real development scenarios
  • Provide production environment best practices
  • Include performance and security considerations

🎯 Browse by Features

Basic Features

Visualization Features

Configuration Management

Web Application Integration

Production Environment

Advanced Features

💡 Usage Tips

1. Development Phase

Recommend using 01_basics and 02_visual examples, focusing on feature implementation and debugging.

2. Testing Phase

Refer to 03_presets examples to establish appropriate log management strategies.

3. Deployment Phase

Use 04_fastapi and 05_production examples to implement production-grade configurations.

4. Optimization Phase

Explore 06_advanced examples to achieve deep customization and performance optimization.

❓ Need Help?

  • Check detailed README documentation in each example directory
  • Run example code and observe output
  • Refer to FAQ section
  • Ask questions on GitHub Issues

Start your Pretty Loguru learning journey! 🎉

Released under the MIT License.