ihsanbal / Logginginterceptor
Licence: mit
An OkHttp interceptor which has pretty logger for request and response. +Mock support
Stars: ✭ 1,149
Projects that are alternatives of or similar to Logginginterceptor
Kakapo.js
🐦 Next generation mocking framework in Javascript
Stars: ✭ 535 (-53.44%)
Mutual labels: interceptor, mock, mocking-framework
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (-79.9%)
Mutual labels: okhttp, interceptor, mock
okhttp-awssigner
An OkHttp interceptor for signing requests with AWSv4 signatures
Stars: ✭ 14 (-98.78%)
Mutual labels: okhttp, interceptor
kras
Efficient server proxying and mocking in Node.js. 💪
Stars: ✭ 18 (-98.43%)
Mutual labels: mock, interceptor
Ok2curl
Convert OkHttp requests into curl logs.
Stars: ✭ 295 (-74.33%)
Mutual labels: okhttp, interceptor
IOS-CoreBluetooth-Mock
Mocking library for CoreBluetooth framework.
Stars: ✭ 142 (-87.64%)
Mutual labels: mock, mocking-framework
OKHttpLogInterceptor
A Pretty OkHttp Logging Interceptor(一款简洁漂亮的OkHttp Logging拦截器)
Stars: ✭ 16 (-98.61%)
Mutual labels: okhttp, interceptor
amoss
Amoss - Apex Mock Objects, Spies and Stubs - A Simple Mocking framework for Apex (Salesforce)
Stars: ✭ 55 (-95.21%)
Mutual labels: mock, mocking-framework
Chucker
🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Stars: ✭ 2,169 (+88.77%)
Mutual labels: okhttp, interceptor
spydriver
🕵️ Lightweight utility to intercept WebDriver and WebElement method calls.
Stars: ✭ 24 (-97.91%)
Mutual labels: mock, interceptor
mocat
🐈 Mocat is a mocking toolbar that allows you to interactively develop and test network requests.
Stars: ✭ 27 (-97.65%)
Mutual labels: mock, mocking-framework
Retrofitcache
RetrofitCache让retrofit2+okhttp3+rxjava配置缓存如此简单。通过注解配置,可以针对每一个接口灵活配置缓存策略;同时让每一个接口方便支持数据模拟,可以代码减小侵入性,模拟数据可以从内存,Assets,url轻松获取。
Stars: ✭ 647 (-43.69%)
Mutual labels: okhttp, mock
RetryRequestInterceptor-for-OkHttp
a interceptor for OkHttp which can save failed request in storage and will retry request until success or retry times over limit , or request live time over limit
Stars: ✭ 42 (-96.34%)
Mutual labels: okhttp, interceptor
Interceptors
Low-level HTTP/HTTPS/XHR/fetch request interception library.
Stars: ✭ 100 (-91.3%)
Mutual labels: interceptor, mock
Interceptor
A browser extension to mock AJAX requests at the browser level
Stars: ✭ 182 (-84.16%)
Mutual labels: interceptor, mock
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (-71.54%)
Mutual labels: mock, mocking-framework
Msw
Seamless REST/GraphQL API mocking library for browser and Node.js.
Stars: ✭ 7,830 (+581.46%)
Mutual labels: mock, mocking-framework
OkHttp3 with pretty logger
LoggingInterceptor - Interceptor forUsage
val client = OkHttpClient.Builder()
client.addInterceptor(LoggingInterceptor.Builder()
.setLevel(Level.BASIC)
.log(VERBOSE)
.addHeader("cityCode","53")
.addQueryParam("moonStatus", "crescent")
.build())
Download
Gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation('com.github.ihsanbal:LoggingInterceptor:3.1.0') {
exclude group: 'org.json', module: 'json'
}
}
Maven:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.ihsanbal</groupId>
<artifactId>LoggingInterceptor</artifactId>
<version>3.1.0</version>
</dependency>
Logger & Mock Support
LoggingInterceptor.Builder()
//Add logger to print log as plain text
.logger(object : Logger {
override fun log(level: Int, tag: String?, msg: String?) {
Log.e("$tag - $level", "$msg")
}
})
//Enable mock for develop app with mock data
.enableMock(BuildConfig.MOCK, 1000L, object : BufferListener {
override fun getJsonResponse(request: Request?): String? {
val segment = request?.url?.pathSegments?.getOrNull(0)
return mAssetManager.open(String.format("mock/%s.json", segment)).source().buffer().readUtf8()
}
})
Level
setLevel(Level.BASIC)
.NONE // No logs
.BASIC // Logging url,method,headers and body.
.HEADERS // Logging headers
.BODY // Logging body
Platform
Platform -log(Platform.WARN) // setting log type
Tag
tag("LoggingI") // Request & response each log tag
request("request") // Request log tag
response("response") // Response log tag
Recipes
Header -addHeader("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 ") // Adding to request
Notes
Some tips about log at this blog post: “The way to get faster on development.”
Also use the filter & configure logcat header for a better result
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].