Skip to content

Commit 72142b2

Browse files
committed
added readme.md
1 parent da7f546 commit 72142b2

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
pretty-console
2+
=============
3+
4+
A simple library for writing various key-value type information to the console or other mediums, such as `<pre>`
5+
6+
###### Example
7+
8+
<pre>
9+
+ -----------------------pretty-console----------------------- +
10+
| # |
11+
| # |
12+
| ## |
13+
| # |
14+
| ### ## |
15+
| ### ## |
16+
| ### ## |
17+
| ## |
18+
| ## |
19+
| ###### ## |
20+
| ###### ## |
21+
| ###### ## |
22+
| ## |
23+
| ### ## |
24+
| ### ## |
25+
| ### # |
26+
| # |
27+
| ## |
28+
| # |
29+
+ +
30+
+ ----Now that you are smiling, here is some information...--- +
31+
+ +
32+
| Why? : pretty-console was made to display diagnostic |
33+
| information in java log files/emails and on |
34+
| web container startup to show |
35+
| system properties and application properties. |
36+
| Enjoy : Please... |
37+
+ ------------------------------------------------------------ +
38+
</pre>
39+
40+
###### Usage
41+
42+
It comes standard with a JVM Key Handler to format JVM type system properties correcty, it can be added to any `ConsoleBox` instance by using
43+
44+
ConsoleBox box = new ConsoleBox(150);
45+
box.handler(new JvmKeyHandler());
46+
47+
Here is a simple example of writing System properties to the console:
48+
49+
ConsoleBox box = new ConsoleBox(150);
50+
box.handler(new JvmKeyHandler());
51+
52+
Enumeration<?> names = System.getProperties().propertyNames();
53+
box.title("JVM Information");
54+
55+
while (names.hasMoreElements()) {
56+
String prop = (String) names.nextElement();
57+
box.line(prop, System.getProperty(prop));
58+
}
59+
60+
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
61+
box.build(System.out);

0 commit comments

Comments
 (0)