-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update * update * update * update * update
- Loading branch information
Showing
12 changed files
with
330 additions
and
245 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Hello Minecraft! Launcher | ||
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package org.jackhuang.hmcl.game; | ||
|
||
import org.jackhuang.hmcl.util.Log4jLevel; | ||
|
||
import static org.jackhuang.hmcl.setting.ConfigHolder.config; | ||
|
||
public final class Log { | ||
public static final int DEFAULT_LOG_LINES = 2000; | ||
|
||
public static int getLogLines() { | ||
Integer lines = config().getLogLines(); | ||
return lines != null && lines > 0 ? lines : DEFAULT_LOG_LINES; | ||
} | ||
|
||
private final String log; | ||
private Log4jLevel level; | ||
private boolean selected = false; | ||
|
||
public Log(String log) { | ||
this.log = log; | ||
} | ||
|
||
public Log(String log, Log4jLevel level) { | ||
this.log = log; | ||
this.level = level; | ||
} | ||
|
||
public String getLog() { | ||
return log; | ||
} | ||
|
||
public Log4jLevel getLevel() { | ||
Log4jLevel level = this.level; | ||
if (level == null) { | ||
level = Log4jLevel.guessLevel(log); | ||
if (level == null) | ||
level = Log4jLevel.INFO; | ||
this.level = level; | ||
} | ||
return level; | ||
} | ||
|
||
public boolean isSelected() { | ||
return selected; | ||
} | ||
|
||
public void setSelected(boolean selected) { | ||
this.selected = selected; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return log; | ||
} | ||
} |
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
Oops, something went wrong.