Skip to content

A versatile and adaptive logging framework designed for seamless integration across various platforms including Linux, Xcode, and macOS terminal.

License

Notifications You must be signed in to change notification settings

wrkstrm/WrkstrmLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—‚๏ธ WrkstrmLog

CI System Status
Swift Package Index
GitHub Action Status Lint Status Test Status

WrkstrmLog is a versatile and flexible logging framework designed for consistent logging across different environments including Linux, Xcode, and macOS terminal. It adapts to various contexts, ensuring that log messages are displayed with consistent formatting regardless of the platform.

๐Ÿ”‘ Key Features

  • ๐ŸŒ Adaptive Logging: Seamless logging across Linux, Xcode, and macOS terminal environments.
  • ๐Ÿ’ผ Multiple Logging Styles: Choose from print, OSLog, and SwiftLog styles.
  • ๐Ÿ”ง Flexible and Customizable: Extend the framework to fit specific logging requirements.
  • ๐Ÿš€ Easy Integration: Quick setup with Swift Package Manager.

Compatibility

  • macOS
  • Linux

๐Ÿ“ฆ Installation

To integrate WrkstrmLog into your project, follow these steps:

๐Ÿ›  Swift Package Manager

Add WrkstrmLog as a dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/wrkstrm/WrkstrmLog.git", .upToNextMajor(from: "0.0.0"))
]

Include WrkstrmLog in your target dependencies:

targets: [
    .target(name: "YourTarget", dependencies: ["WrkstrmLog"]),
]

๐Ÿ“š Usage

Import WrkstrmLog and start logging with ease:

  1. ๐Ÿ“ฅ Import the Library:

    import WrkstrmLog
  2. ๐Ÿ”จ Initialize Logger: Create a logger instance with your system and category:

    let logger = Log(system: "YourSystem", category: "YourCategory")
  3. ๐Ÿ“ Log Messages: Use various logging methods like verbose, info, error, and guard:

    logger.verbose("Verbose message")
    logger.info("Info message")
    logger.error("Error message")
    Log.guard("Critical error")

๐ŸŽจ Customization

WrkstrmLog offers high customization capabilities. Extend or modify it to suit your project's needs, and utilize the sample formatters as a foundation for custom implementations.

๐Ÿค Contributing

๐ŸŒŸ Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“œ License

๐Ÿ“„ Distributed under the MIT License. See LICENSE for more information.

๐Ÿ“ฌ Contact

๐Ÿ”— Project Link: https://github.com/wrkstrm/WrkstrmLog

๐Ÿ’– Acknowledgments

  • Developed by github.com/@rismay

๐Ÿ“ WrkstrmLog: Unifying the Symphony of Swift Logging ๐ŸŽผ

1. ๐ŸŽญ The Challenge: Taming the Wild Logs

Ever felt like your logs are speaking different languages across platforms? You're not alone! ๐Ÿ˜…

Swift developers face a common nemesis:

#if DEBUG
print("Debug: Entering function") // ๐Ÿ‘€ Only in debug? What about production?
#endif

// ... ๐Ÿ—๏ธ Your awesome code here ...

if let error = performOperation() {
  print("Error occurred: \(error)") // ๐Ÿ˜ฑ Errors in production, but where?
}

This approach is like trying to conduct an orchestra with musicians playing from different sheets! ๐ŸŽป๐ŸŽบ๐Ÿฅ

2. ๐Ÿš€ Enter WrkstrmLog: The Maestro of Swift Logging

WrkstrmLog steps in as the conductor, bringing harmony to your logging chaos. It's like having a universal translator for your logs! ๐ŸŒ๐Ÿ—ฃ๏ธ

import WrkstrmLog

let log = Log(system: "com.myapp", category: "networking")

func someFunction() {
  log.debug("๐ŸŽฌ Action! Entering someFunction")
  
  // ๐Ÿ—๏ธ Your symphony of code here
  
  if let error = performOperation() {
    log.error("๐Ÿšจ Plot twist! Operation failed: \(error)")
  }
  
  log.debug("๐ŸŽญ Scene end. Exiting someFunction")
}

3. ๐Ÿ’Ž Core Features and Benefits

  • ๐ŸŽฏ Unified Interface: One log to rule them all!
  • ๐ŸŒˆ Flexible Configuration: Dress your logs for any occasion.
  • ๐Ÿท๏ธ Smart Categorization: Find that needle in the haystack.
  • ๐Ÿ”€ Multi-Style Output: Console, Apple's Unified Logging, Swift Logging - we speak them all!
  • ๐ŸŒ Cross-Platform Consistency: From Xcode to Linux, we've got you covered.
  • ๐Ÿงฉ Extensibility: Build your own log empire!

4. ๐Ÿ Getting Started

๐Ÿ“ฆ Installation

Add this line to your Package.swift and let the magic begin:

dependencies: [
    .package(url: "https://github.com/wrkstrm/WrkstrmLog.git", .upToNextMajor(from: "1.0.0"))
]

๐Ÿ”ฐ Basic Usage

import WrkstrmLog

let log = Log.shared
log.info("๐ŸŽ‰ App launched! Time to rock and roll!")

5. ๐ŸŽ“ Advanced Usage and Best Practices

WrkstrmLog is like a Swiss Army knife for logging. Here's a taste of its power:

Environment WrkstrmLog Magic Default Swift (Boring) Logging
Xcode ๐Ÿ” Uses .os style. Debug console becomes your crystal ball. Basic print() and os.Logger in console.
macOS Terminal ๐Ÿ–จ๏ธ .print style. Logs pop right into stdout. print() works, os.Logger plays hide and seek.
Linux ๐Ÿง .swift style. Bridging the gap like a boss. print() only. os.Logger goes MIA.

6. โšก Performance Considerations

We've turbocharged WrkstrmLog:

  • ๐Ÿง  Lazy evaluation: Logs think before they speak.
  • ๐Ÿšฆ Efficient filtering: Only the VIP logs get through.

7. ๐Ÿ”ฎ Conclusion and Next Steps

WrkstrmLog isn't just a logger; it's your ticket to logging nirvana. ๐Ÿง˜โ€โ™‚๏ธ Say goodbye to platform-specific headaches and hello to logging bliss!

Stay tuned for our next episode: "WrkstrmLog Advanced: Turning Your Logs into Superheroes!" ๐Ÿฆธโ€โ™‚๏ธ๐Ÿ“š


For more mind-blowing details, swing by our GitHub repo or dive deep into our docs. Happy logging! ๐ŸŽ‰๐Ÿ”ง

About

A versatile and adaptive logging framework designed for seamless integration across various platforms including Linux, Xcode, and macOS terminal.

Topics

Resources

License

Stars

Watchers

Forks

Languages