AFNetworkActivityLogger alternatives and similar libraries
Based on the "Logging" category.
Alternatively, view AFNetworkActivityLogger alternatives based on common mentions on social networks and blogs.
-
CocoaLumberjack
A fast & simple, yet powerful & flexible logging framework for Mac and iOS -
SwiftyBeaver
Convenient & secure logging during development & release in Swift 4 & 5 -
GodEye
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes -
XCGLogger
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. -
TinyConsole
📱💬🚦 TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible. -
Watchdog
Class for logging excessive blocking on the main thread -
Rainbow
Delightful console output for Swift developers. -
CleanroomLogger
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant -
Willow
Willow is a powerful, yet lightweight logging library written in Swift. -
KZLinkedConsole
Clickable links in your Xcode console, so you never wonder which class logged the message. -
QorumLogs
:closed_book: Swift Logging Utility for Xcode & Google Docs -
Diagnostics
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs. -
SwiftTrace
Trace Swift and Objective-C method invocations -
JustLog
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. -
Gedatsu
Gedatsu provide readable format about AutoLayout error console log -
LxDBAnything
Automate box any value! Print log without any format control symbol! Change debug habit thoroughly! -
XLFacility
Elegant and extensive logging facility for OS X & iOS (includes database, Telnet and HTTP servers) -
Twitter Logging Service
Twitter Logging Service is a robust and performant logging framework for iOS clients -
Aardvark
Aardvark is a library that makes it dead simple to create actionable bug reports. -
SwiftyTextTable
A lightweight library for generating text tables. -
Loggerithm
A lightweight Swift logger, uses print in development and NSLog in production. Support colourful and formatted output. -
BlockTypeDescription
Show type signatures when logging blocks -
puree
[Obsoleted] A log collector for iOS (new version! -> https://github.com/cookpad/Puree-Swift) -
Logkit
An efficient logging library for OS X, iOS, watchOS, and tvOS – written in Swift. Log to console, file, HTTP service, or your own endpoint. Simple to get started, but smartly customizable. -
Atlantis
A powerful input-agnostic swift logging framework made to speed up development with maximum readability. -
AEConsole
Customizable Console UI overlay with debug log on top of your iOS App -
Bugfender
Bugfender SDK for iOS, a remote logger tailor-made for mobile -
CleanroomASL
A Swift-based API for reading from & writing to the Apple System Log (more commonly known somewhat inaccurately as "the console") -
TraceLog
TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS. -
ReflectedStringConvertible
A protocol that allows any class to be printed as if it were a struct or a JSON object. -
XLTestLog
Styling and coloring your XCTest logs on Xcode Console -
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift. -
AELog
Simple, lightweight and flexible debug logging framework written in Swift -
Spy
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. -
StoryTeller
A log should tell a story, not drown the reader in irrelevance.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of AFNetworkActivityLogger or a related project?
README
AFNetworkActivityLogger
AFNetworkActivityLogger
is an extension for AFNetworking 3.0 that logs network requests as they are sent and received.
AFNetworkActivityLogger
listensAFNetworkingTaskDidStartNotification
andAFNetworkingTaskDidFinishNotification
notifications, which are posted by AFNetworking as session tasks are started and finish. For further customization of logging output, users are encouraged to implement desired functionality by creating new objects that conform toAFNetworkActivityLoggerProtocol
.
2.x -> 3.x Migration
3.0.0 featured the following breaking API changes:
- The log
level
property is now found on the individual unique loggers, rather than the shared logger. This allows for more advanced customization options for logging level. - The
filterPredicate
property is now found on the individual unique loggers, rather than the shared logger. This allows for more advanced customization options for logging specific requests.
Usage
Add the following code to AppDelegate.m -application:didFinishLaunchingWithOptions:
:
[[AFNetworkActivityLogger sharedLogger] startLogging];
Now all NSURLSessionTask
objects created by an AFURLSessionManager
will have their request and response logged to the console, a la:
GET http://example.com/foo/bar.json
200 http://example.com/foo/bar.json [0.1860 s]
If the default logging level is too verbose—say, if you only want to know when requests fail—then changing it is as simple as:
[[AFNetworkActivityLogger sharedLogger] setLevel:AFLoggerLevelError];
Logging Levels
By default, the shared logger is configured with an AFNetworkActivityConsoleLogger
with a debug level set to AFLoggerLevelInfo
. To change the level, simply access the logger through the loggers
property, and adjust the level. The following levels are provided:
AFLoggerLevelOff
: Do not log requests or responses.AFLoggerLevelDebug
:Logs HTTP method, URL, header fields, & request body for requests, and status code, URL, header fields, response string, & elapsed time for responses.AFLoggerLevelInfo
: Logs HTTP method & URL for requests, and status code, URL, & elapsed time for responses.AFLoggerLevelError
: Logs HTTP method & URL for requests, and status code, URL, & elapsed time for responses, but only for failed requests.
Filtering Requests
To limit the requests that are logged by a unique logger, each object that conforms to AFNetworkActivityLoggerProtocol
has a filterPredicate
property. If the predicate returns true, the request will not be forwarded to the logger. For example, a custom file logger could be created that only logs requests for http://httpbin.org
, while a console logger could be used to log all errors in the application.
AFNetworkActivityConsoleLogger *testLogger = [AFNetworkActivityConsoleLogger new];
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(NSURLRequest * _Nonnull request, NSDictionary<NSString *,id> * _Nullable bindings) {
return !([[request URL] baseURL] isEqualToString:@"httpbin.org"])
}];
[testLogger setFilterPredicate:predicate];
Custom Loggers
By default, the shared logger is configured with an AFNetworkActivityConsoleLogger
.
To create a custom logger, create a new object that conforms to AFNetworkActivityLoggerProtocol
, and add it to the shared logger. Be sure and configure the proper default logging level.
License
AFNetworkActivityLogger is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the AFNetworkActivityLogger README section above
are relevant to that project's source code only.