-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ mica-http 优化,可以在没有 slf4j 的情况下开启控制台日志
- Loading branch information
1 parent
bdf6ba5
commit 264e327
Showing
3 changed files
with
63 additions
and
23 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
mica-http/src/main/java/net/dreamlu/mica/http/HttpConsoleLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2019-2029, Dreamlu ([email protected] & www.dreamlu.net). | ||
* <p> | ||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.gnu.org/licenses/lgpl.html | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.dreamlu.mica.http; | ||
|
||
import okhttp3.logging.HttpLoggingInterceptor; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
/** | ||
* OkHttp console log. | ||
* | ||
* @author L.cm | ||
*/ | ||
public enum HttpConsoleLogger implements HttpLoggingInterceptor.Logger { | ||
/** | ||
* 实例 | ||
*/ | ||
INSTANCE; | ||
|
||
public void log(@Nonnull String message) { | ||
// 统一添加前缀,方便在茫茫日志中查看 | ||
System.out.print("ConsoleLogger: "); | ||
System.out.println(message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters