Skip to content

Add Logrus Structured Logging Package Challenge Series #474

@RezaSi

Description

@RezaSi

Add Logrus Structured Logging Package Challenge Series

Issue Description

Create a comprehensive Logrus package challenge series to teach developers professional logging practices in Go applications, from basic logging to advanced structured logging patterns used in production systems.

What needs to be implemented

Package Structure

Create packages/logrus/ with the following challenges:

  1. Challenge 1: Basic Logging & Levels (Beginner)

    • Setting up Logrus logger
    • Log levels (Debug, Info, Warn, Error, Fatal, Panic)
    • Basic formatting and output
    • Build a simple application with proper logging
  2. Challenge 2: Structured Logging & Fields (Intermediate)

    • Structured logging with fields
    • Context-aware logging
    • Custom formatters (JSON, Text)
    • Request tracing and correlation IDs
  3. Challenge 3: Advanced Configuration & Hooks (Intermediate)

    • Custom log hooks for external systems
    • Log rotation and file management
    • Multiple output destinations
    • Performance optimization and async logging
  4. Challenge 4: Production Logging Patterns (Advanced)

    • Centralized logging with ELK stack integration
    • Log aggregation and monitoring
    • Error tracking and alerting
    • Logging best practices for microservices

Required Files for Each Challenge

  • README.md - Challenge description and requirements
  • solution-template.go - Starting code template with TODOs
  • solution-template_test.go - Comprehensive test suite
  • learning.md - Educational content (400+ lines)
  • hints.md - Step-by-step guidance
  • metadata.json - Challenge metadata
  • go.mod and go.sum - Dependencies
  • run_tests.sh - Testing script

Package Metadata (package.json)

{
  "name": "logrus",
  "display_name": "Logrus Structured Logging",
  "description": "Structured, pluggable logging for Go applications",
  "version": "v1.9.3",
  "github_url": "https://github.com/sirupsen/logrus",
  "documentation_url": "https://pkg.go.dev/github.com/sirupsen/logrus",
  "stars": 24000,
  "category": "logging",
  "difficulty": "beginner_to_advanced",
  "prerequisites": ["basic_go", "json_concepts", "file_operations"],
  "learning_path": [
    "challenge-1-basic-logging-levels",
    "challenge-2-structured-fields",
    "challenge-3-advanced-hooks",
    "challenge-4-production-patterns"
  ],
  "tags": ["logging", "structured", "monitoring", "debugging", "observability"],
  "estimated_time": "4-6 hours",
  "real_world_usage": [
    "Application debugging and monitoring",
    "Error tracking and alerting",
    "Audit trails and compliance",
    "Performance monitoring",
    "Microservices observability",
    "Production troubleshooting"
  ]
}

Learning Objectives

  • Master structured logging principles and best practices
  • Learn different log levels and when to use them
  • Implement context-aware logging with fields
  • Build custom formatters and hooks
  • Understand production logging architecture
  • Practice with real-world monitoring scenarios

Resources

Acceptance Criteria

  • All 4 challenges implemented with complete file structure
  • Each challenge demonstrates different logging patterns
  • Comprehensive tests covering logging scenarios
  • Learning materials explain logging best practices
  • Code follows existing repository patterns and style
  • Examples of integration with monitoring systems
  • Documentation covers production deployment considerations

Getting Started

  1. Study existing package challenges structure
  2. Review Logrus documentation and examples
  3. Set up sample applications for logging testing
  4. Follow the package challenge guidelines from CONTRIBUTING.md
  5. Start with basic logging and progress to advanced patterns

Need Help?

  • Check out our Contributing Guidelines
  • Look at existing package implementations for patterns
  • Ask questions in the comments below

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions