Skip to content

laconicman/OSLogLoggingMiddleware

Repository files navigation

OSLogLoggingMiddleware

Swift Compatibility Platform Compatibility

A logging middleware package for Swift OpenAPI Generator/Runtime that provides detailed request and response logging capabilities. Uses system OSLog. The library is nothing special, just simple reusable package, that you can easily add to a project and remove from it once no longer needed. Or just turn logging off.

Features

  • 📝 Comprehensive request and response logging
  • ⚡️ Pretty printed
  • 🔧 Configurable logging levels and formats
  • 🎯 Non-intrusive middleware design

Installation

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/laconicman/OSLogLoggingMiddleware.git", from: "1.0.0")
]

Then add the dependency to your target:

targets: [
    .target(
        name: "YourTarget",
        dependencies: [
            .product(name: "OSLogLoggingMiddleware", package: "OSLogLoggingMiddleware")
        ]
    )
]

Usage

Basic Setup

import OSLogLoggingMiddleware
import OpenAPIRuntime

let client = Client(
    serverURL: URL(string: "https://api.example.com")!,
    middleware: [
        OSLogLoggingMiddleware()
    ]
)

Contributing

Contributions are welcome!

This is helper package for the following

License

This project is licensed under the Apache License 2.0.

About

Simple OSLog logging middleware

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages