Simple, lightweight and flexible debug logging framework written in Swift

Related tags

Logging AELog
Overview

Language Swift 5.1 Platforms iOS | watchOS | tvOS | macOS CocoaPods Carthage Swift Package Manager License MIT

AELog

Simple, lightweight and flexible debug logging minion written in Swift

If you find yourself in upcoming statements, then you probably want to use AELog:

  • I just want to log anything to console while working on a project, then turn it off when going live.
  • I'd like to enable / disable logging on a file level, and also to format log lines just the way I like.
  • I don't want to have anything other then that, I just want to be up and running in no time.

Index

Features

  • Top level logging which can be disabled when needed
  • Enable or disable logging on a file level
  • Customizable format and verbosity of log lines

Usage

/// Log detailed debugging information with a simple one liner:

aelog()

/// - Note: if this was on line 21 in `viewDidLoad` of a `ViewController`, output could look like this:
/// 2016-04-03 21:08:00.123 -- [Main] ViewController (21) -> viewDidLoad() >

/// Add custom text to log line:

aelog("hi there")

/// Log random items (some interesting variables at the moment)

let text = "One two three four five"
let x: CGFloat = 21
let y: CGFloat = 8
let size = CGSize(width: 19, height: 84)
let rect = CGRect(x: x, y: y, width: size.width, height: size.height)
let range = 1...5

aelog(text, x, y, size, rect, range, Log.shared, self)

/// - Note: in this case output could look like this:
/// 04:01:05.967 -- ViewController (30) -> viewDidAppear > 

/// #0: String | "One two three four five"
/// #1: Double | 21.0
/// #2: Double | 8.0
/// #3: CGSize | (19.0, 84.0)
/// #4: CGRect | (21.0, 8.0, 19.0, 84.0)
/// #5: CountableClosedRange<Int> | CountableClosedRange(1...5)
/// #6: Log | AELog.Log
/// #7: ViewController | <AELogDemo_iOS.ViewController: 0x7fd14c41dd60>

/// Log both to debugger and device console:

aelog("this should be logged just in case...", mode: .nsLog)

/// Log Settings

/// Enable or disable logging with one flag and customize formatting as you like.
/// - Warning: `aelog` will by default work only if logging is enabled and file is not disabled in settings,
/// otherwise it will do nothing, but with `mode: .nsLog` it will always work, wether logging is enabled or not.

let settings = Log.shared.settings

settings.isEnabled = true
settings.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
settings.template = "{date} -- [{thread}] {file} ({line}) -> {function} > {text}"

/// - Note: toggle logging for specific files like this:
settings.files = [
    "AppDelegate" : false,
    "ViewController" : true
]

/// LogDelegate

Log.shared.delegate = self

func didLog(line: Line, mode: Log.Mode) {
    /// - Note: do something here?
}

One more thing

Have you ever wanted to see the output of your app while you're not at your computer, like in real time directly on your iOS device? Yeah, me neither, but just in case you change your mind (like I did), check out AEConsole - customizable console UI overlay with debug log on top of your iOS app. After all, AELog was made just to complement AEConsole.

Installation

License

AELog is released under the MIT license. See LICENSE for details.

You might also like...
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant

CleanroomLogger CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant. The API provided by Cleanro

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
Swift library for working with Debug Adapter Protocol (DAP)

DebugAdapterProtocol This is a Swift library for interacting with Debug Adapter Protocol. It contains type definitions and utilities useful for both s

An extensible logging framework for Swift
An extensible logging framework for Swift

Log is a powerful logging framework that provides built-in themes and formatters, and a nice API to define your owns. Get the most out of Log by insta

A powerful input-agnostic swift logging framework made to speed up development with maximum readability.
A powerful input-agnostic swift logging framework made to speed up development with maximum readability.

The Swift logging framework. Atlantis is an extremely powerful logging framework that I've created for everyday use, including enterprise development

Customizable Console UI overlay with debug log on top of your iOS App
Customizable Console UI overlay with debug log on top of your iOS App

AEConsole Customizable Console UI overlay with debug log on top of your iOS App AEConsole is built on top of AELog, so you should probably see that fi

Automate box any value! Print log without any format control symbol! Change debug habit thoroughly!

LxDBAnything Automate box any value! Print log without any format control symbol! Change debug habit thoroughly! Installation You only need drag LxD

A simple logging package for Swift

OhMyLog OhMyLog is a simple logging package for Swift. It supports the following features: Six logging levels ( 👣 , 🔍 , 💡 , ⚠️ , 🚨 , 💊 ) Display

Simple logging for simples needs.

Simple logging for simples needs.

Comments
  • crash when use Xcode13.3

    crash when use Xcode13.3

    Hi, when use Xcode13.3, it crash at: let array = items.first.unsafelyUnwrapped as! [Any] the message is: Could not cast value of type 'Swift.String' (0x12f6398d8) to 'Swift.Array' (0x12f66fe88).

    Help please,Thanks.

    opened by Dast1Woop 5
  • Using `: class` on protocols is deprecated

    Using `: class` on protocols is deprecated

    https://github.com/tadija/AELog/blob/f559b3014d234c3997dc6272d9b29d705b6933c3/Sources/AELog/Log.swift#L57

    This particular line is giving a warning while compiling on Xcode 13.2.1, as using protocol SomeProtocol: class {} is now deprecated.

    Changing it to protocol SomeProtocol: AnyObject {} is the suggested way of updating it, according to Xcode. The warning message says:

    Using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead

    opened by alejandroivan 1
Owner
Marko Tadić
keep it simple
Marko Tadić
Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift.

Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift. It allows to log with different levels and on different channels. You can define what levels and channels actually are.

AppUnite Sp. z o.o. Spk. 12 Jul 28, 2021
Twitter Logging Service is a robust and performant logging framework for iOS clients

Twitter Logging Service Background Twitter created a framework for logging in order to fulfill the following requirements: fast (no blocking the main

Twitter 290 Nov 15, 2022
A fast & simple, yet powerful & flexible logging framework for Mac and iOS

CocoaLumberjack CocoaLumberjack is a fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS. How to get started Fir

null 12.9k Jan 9, 2023
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.

JustLog JustLog takes logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support f

Just Eat 509 Dec 10, 2022
A logging backend for swift-log that sends logging messages to Logstash (eg. the ELK stack)

LoggingELK LoggingELK is a logging backend library for Apple's swift-log The LoggingELK library provides a logging backend for Apple's apple/swift-log

null 17 Nov 15, 2022
A flexible logging library written in Swift

Puppy Puppy is a flexible logging library written in Swift ?? It supports multiple transports(console, file, syslog, and oslog) as loggers. It not onl

Koichi Yokota 92 Dec 29, 2022
A modern, flexible logging tool

NSLogger NSLogger is a high performance logging utility which displays traces emitted by client applications running on macOS, iOS and Android. It rep

Florent Pillet 5k Dec 22, 2022
Willow is a powerful, yet lightweight logging library written in Swift.

Willow Willow is a powerful, yet lightweight logging library written in Swift. Features Requirements Migration Guides Communication Installation Cocoa

Nike Inc. 1.3k Nov 16, 2022
A lightweight logging framework for Swift

HeliumLogger Provides a lightweight logging implementation for Swift which logs to standard output. Features Logs output to stdout by default. You can

Kitura 174 Nov 30, 2022
A lightweight logging framework for Swift

HeliumLogger Provides a lightweight logging implementation for Swift which logs to standard output. Features Logs output to stdout by default. You can

Kitura 174 Nov 30, 2022