Skip to content

Commit

Permalink
Cleanup of LogProperties uri stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
agentgt committed Jan 18, 2024
1 parent ccdbcdc commit 3372c1f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
1 change: 0 additions & 1 deletion core/src/main/java/io/jstach/rainbowgum/LogEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public interface EncoderProvider {
* @param name name of encoder.
* @param properties key value config.
* @return output.
* @see LogProperties#of(URI)
*/
LogEncoder provide(URI uri, String name, LogProperties properties);

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/jstach/rainbowgum/LogOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public interface OutputProvider {
* @param properties key value config.
* @return output.
* @throws IOException if unable to use the URI.
* @see LogProperties#of(URI)
*/
LogOutput output(URI uri, String name, LogProperties properties) throws IOException;

Expand Down
30 changes: 10 additions & 20 deletions core/src/main/java/io/jstach/rainbowgum/LogProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ public Builder order(int order) {
return this;
}

/**
* Sets what is called on {@link LogProperties#valueOrNull(String)}.
* @param function valueOrNull func.
* @return this.
*/
public Builder function(Function<String, String> function) {
this.function = function;
return this;
}

/**
* Parses a string as {@link Properties}.
* @param properties properties as a string.
Expand Down Expand Up @@ -341,26 +351,6 @@ public static LogProperties of(List<? extends LogProperties> logProperties) {
return of(logProperties, StandardProperties.EMPTY);
}

/**
* Creates log properties from a {@linkplain URI#getQuery() URI query} in <a href=
* "https://www.w3.org/TR/2014/REC-html5-20141028/forms.html#url-encoded-form-data">
* application/x-www-form-urlencoded </a> format useful for parsing {@link LogOutput}
* configuration. <strong>This parser unlike form encoding uses <code>%20</code> for
* space as the data is coming from a URI.</strong>
* @param uri uri to get query from.
* @return properties
* @see LogOutput
*/
public static LogProperties of(URI uri) {
Map<String, String> m = new LinkedHashMap<>();
parseUriQuery(uri.getRawQuery(), (k, v) -> {
if (v != null) {
m.put(k, v);
}
});
return new MapProperties(uri.toString(), m);
}

/**
* Parse a {@linkplain URI#getRawQuery() URI query} in <a href=
* "https://www.w3.org/TR/2014/REC-html5-20141028/forms.html#url-encoded-form-data">
Expand Down
11 changes: 8 additions & 3 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ logical resource (it might not be a single physical resource particularly in the

# Features in limbo

* Level changing loggers - medium
* Filters - medium
* Markers - We might use this for some other kind of features
* Key values that are not MDC aka new slf4j event builder
Expand All @@ -24,10 +23,16 @@ logical resource (it might not be a single physical resource particularly in the

## TODO before release

- [ ] A network based LogOutput. Probably AMQP.
- [ ] A console theme.
- [ ] Level changing loggers - medium
- [X] A network based LogOutput. Probably AMQP.
- [ ] More JSON encoders.
- [ ] A console theme package based off of HL (logging colorizer).
- [ ] Remove all the field based formatters.
- [ ] Code samples and instructions for custom configuration.
- [ ] How to setup a ServiceLoader registration for plugins
- [ ] Scoped Value plugin
- [ ] JEP 430 String templates example
- [ ] Check performance again
- [ ] Remove bloat / unused code
- [ ] Check performance again

0 comments on commit 3372c1f

Please sign in to comment.