Skip to content

tichise/TILogger

Repository files navigation

TILogger CocoaPods Version Platform License

TILogger is a lightweight, flexible logging solution for Swift applications. It provides both instance-based and static logging methods with customizable formatting options.

Features

  • 🚀 Simple & Lightweight: Easy to integrate and use
  • 🎨 Customizable: Configure prefix and date format to match your needs
  • 🔄 Flexible Usage: Both instance-based and static methods available
  • 💎 Beautiful Output: Emoji-based log levels for better visibility
  • 🏃 Method Chaining: Fluent interface for configuration
  • 📱 DEBUG Mode Only: Logs only appear in debug builds for better production performance

Examples

Instance-based Usage

// Basic usage
TILogger().verbose("test")
TILogger().debug("test")
TILogger().info("test")
TILogger().warning("test")
TILogger().error("test")

// With custom prefix
TILogger().setPrefix("log").debug("test")

// With custom date format
TILogger().setPrefix("TILogger")
         .setDateFormat("yyyy/MM/dd HH:mm:ss")
         .info("test")

// Without prefix
TILogger().setPrefix("").verbose("test")

// Logging various types
TILogger().verbose(2333)  // Numbers

Static Usage (New! 🎉)

// Quick static methods
TILogger.verbose("logging made easy")
TILogger.debug("debugging in progress")
TILogger.info("useful information")
TILogger.warning("warning message")
TILogger.error("error occurred")

// Using shared instance
TILogger.shared.setPrefix("CustomPrefix")
TILogger.info("configured through shared instance")

Output Format

2024/03/15 12:34:56 TILogger 💜 VERBOSE ViewController #123 viewDidLoad - Your log message

Format components:

  • Date/Time (customizable format)
  • Prefix (customizable)
  • Log Level (with emoji)
  • File name
  • Line number
  • Function name
  • Log message

Log Levels

  • 💜 VERBOSE
  • 💚 DEBUG
  • 💙 INFO
  • 💛 WARNING
  • ❤️ ERROR

Installation

CocoaPods

pod 'TILogger'

Swift Package Manager

Add the following to your Package.swift:

dependencies: [
    .package(url: "https://github.com/your-repo/TILogger.git", from: "1.4.0")
]

License

TILogger is available under the MIT license.

About

TILogger is a lightweight, flexible logging solution for Swift applications. It provides both instance-based and static logging methods with customizable formatting options.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors