forked from java-native-access/jna
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to enable debug logging in quiche (java-native-access#5)
Motivation: During development it is often useful to have debug logging enabled Modifications: Allow to use quiche_enable_debug_logging(...) and have it delegate to our InternalLogger Result: Fixes netty/netty-incubator-codec-quic#4
- Loading branch information
1 parent
c386b37
commit c9b839e
Showing
8 changed files
with
238 additions
and
6 deletions.
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
src/main/java/io/netty/incubator/codec/quic/QuicheLogger.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,34 @@ | ||
/* | ||
* Copyright 2020 The Netty Project | ||
* | ||
* The Netty Project licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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 io.netty.incubator.codec.quic; | ||
|
||
import io.netty.util.internal.logging.InternalLogger; | ||
|
||
/** | ||
* Delegates QUICHE logging to {@link InternalLogger}. | ||
*/ | ||
final class QuicheLogger { | ||
private final InternalLogger logger; | ||
|
||
QuicheLogger(InternalLogger logger) { | ||
this.logger = logger; | ||
} | ||
|
||
// Called from JNI. | ||
void log(String msg) { | ||
logger.debug(msg); | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannelId.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,57 @@ | ||
/* | ||
* Copyright 2020 The Netty Project | ||
* | ||
* The Netty Project licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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 io.netty.incubator.codec.quic; | ||
|
||
import io.netty.channel.ChannelId; | ||
|
||
final class QuicheQuicChannelId implements ChannelId { | ||
|
||
private final String id; | ||
|
||
QuicheQuicChannelId(String id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public String asShortText() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public String asLongText() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public int compareTo(ChannelId o) { | ||
return id.compareTo(o.asLongText()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return id.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return id.equals(obj); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return id; | ||
} | ||
} |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2020 The Netty Project | ||
~ | ||
~ The Netty Project licenses this file to you under the Apache License, | ||
~ version 2.0 (the "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at: | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ 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. | ||
--> | ||
<configuration debug="false"> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="${logLevel:-debug}"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |