forked from I2P_Developers/i2p.i2p
Console: Fix log file size config bug on /configlogging bug (ticket #1996)
This commit is contained in:
@ -23,10 +23,7 @@ public class ConfigLoggingHelper extends HelperBase {
|
|||||||
public String getMaxFileSize() {
|
public String getMaxFileSize() {
|
||||||
int bytes = _context.logManager().getFileSize();
|
int bytes = _context.logManager().getFileSize();
|
||||||
if (bytes <= 0) return "1.00 MB";
|
if (bytes <= 0) return "1.00 MB";
|
||||||
// " " comes back in the POST as 0xc2 0xa0
|
return DataHelper.formatSize2(bytes, false) + 'B';
|
||||||
// non-breaking space is U+00A0 which is 0xc2 0xa0 in UTF-8.
|
|
||||||
// we could figure out where the UTF-8 problem is but why bother.
|
|
||||||
return DataHelper.formatSize2(bytes).replace(" ", " ") + 'B';
|
|
||||||
}
|
}
|
||||||
public String getLogLevelTable() {
|
public String getLogLevelTable() {
|
||||||
StringBuilder buf = new StringBuilder(32*1024);
|
StringBuilder buf = new StringBuilder(32*1024);
|
||||||
|
@ -1553,10 +1553,21 @@ public class DataHelper {
|
|||||||
/**
|
/**
|
||||||
* Like formatSize but with a non-breaking space after the number
|
* Like formatSize but with a non-breaking space after the number
|
||||||
* This seems consistent with most style guides out there.
|
* This seems consistent with most style guides out there.
|
||||||
* Use only in HTML
|
* Use only in HTML, and not inside form values (use
|
||||||
* @since 0.7.14
|
* formatSize2(bytes, false) there instead).
|
||||||
|
* @since 0.7.14, uses thin non-breaking space since 0.9.31
|
||||||
*/
|
*/
|
||||||
public static String formatSize2(long bytes) {
|
public static String formatSize2(long bytes) {
|
||||||
|
return formatSize2(bytes, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like formatSize but with a space after the number
|
||||||
|
* This seems consistent with most style guides out there.
|
||||||
|
* @param nonBreaking use an HTML thin non-breaking space ( )
|
||||||
|
* @since 0.9.31
|
||||||
|
*/
|
||||||
|
public static String formatSize2(long bytes, boolean nonBreaking) {
|
||||||
double val = bytes;
|
double val = bytes;
|
||||||
int scale = 0;
|
int scale = 0;
|
||||||
while (val >= 1024) {
|
while (val >= 1024) {
|
||||||
@ -1568,17 +1579,18 @@ public class DataHelper {
|
|||||||
|
|
||||||
// Replace with thin non-breaking space   (more consistent/predictable width between fonts & point sizes)
|
// Replace with thin non-breaking space   (more consistent/predictable width between fonts & point sizes)
|
||||||
|
|
||||||
String str = fmt.format(val);
|
String space = nonBreaking ? " " : " ";
|
||||||
|
String str = fmt.format(val) + space;
|
||||||
switch (scale) {
|
switch (scale) {
|
||||||
case 1: return str + " K";
|
case 1: return str + "K";
|
||||||
case 2: return str + " M";
|
case 2: return str + "M";
|
||||||
case 3: return str + " G";
|
case 3: return str + "G";
|
||||||
case 4: return str + " T";
|
case 4: return str + "T";
|
||||||
case 5: return str + " P";
|
case 5: return str + "P";
|
||||||
case 6: return str + " E";
|
case 6: return str + "E";
|
||||||
case 7: return str + " Z";
|
case 7: return str + "Z";
|
||||||
case 8: return str + " Y";
|
case 8: return str + "Y";
|
||||||
default: return bytes + " ";
|
default: return bytes + space;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
2017-07-06 str4d
|
||||||
|
* Console: Fix log file size config bug on /configlogging bug (ticket #1996)
|
||||||
|
|
||||||
2017-07-02 str4d
|
2017-07-02 str4d
|
||||||
* Console:
|
* Console:
|
||||||
- Show correct icon for "Firewalled" network status
|
- Show correct icon for "Firewalled" network status
|
||||||
|
Reference in New Issue
Block a user