Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make picocli trace levels case-insensitive #1126

Closed
remkop opened this issue Jul 15, 2020 · 0 comments
Closed

Make picocli trace levels case-insensitive #1126

remkop opened this issue Jul 15, 2020 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Jul 15, 2020

Currently, only values WARN, INFO and DEBUG, and empty String or case-insensitive "true" are valid values for the system property picocli.trace.

We can make this more user-friendly by allowing values WARN, INFO and DEBUG to be case-insensitive.

Index: src/main/java/picocli/CommandLine.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/picocli/CommandLine.java	(date 1594795763490)
+++ src/main/java/picocli/CommandLine.java	(date 1594795763490)
@@ -16896,7 +16896,7 @@
             if (tracer.level.isEnabled(this)) { tracer.stream.printf(prefix(msg), params); }
         }
         private String prefix(String msg) { return "[picocli " + this + "] " + msg; }
-        static TraceLevel lookup(String key) { return key == null ? WARN : empty(key) || "true".equalsIgnoreCase(key) ? INFO : valueOf(key); }
+        static TraceLevel lookup(String key) { return key == null ? WARN : empty(key) || "true".equalsIgnoreCase(key) ? INFO : valueOf(key.toUpperCase(ENGLISH)); }
     }
     static class Tracer {
         TraceLevel level = TraceLevel.lookup(System.getProperty("picocli.trace"));
@remkop remkop added this to the 4.5 milestone Jul 15, 2020
@remkop remkop changed the title Make picocli tracer case-insensitive Make picocli trace levels case-insensitive Jul 15, 2020
@remkop remkop closed this as completed in 4deed31 Jul 15, 2020
@remkop remkop modified the milestones: 4.5, 4.4.1 Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant