[Solved]Logging Events

How would i change the color style of a log on the console through the coding?..here’s what i have
public void startupLogs(GamePreInitializationEvent L1){
logger.info(“PreInitialization of Explosion Guard in Progress!”);
}

now what i’d like is for the “” part to be a specified color so that way tracking things for beta would be easier :slight_smile: some help on this would be nice thank you

Logs are text files, there are no colors.

ok then how does the different levels of logs have different colors like warning is red info is grey etc? lol maybe they’re not called logs

Well I’m not sure what your logfiles look like but mine are just plain text.
Some text editors and log viewers do read the files to change colors but that’s up to the viewer.

lol no the one in console through command prompt as the server is actually running lol

I only get colors when joining or leaving the game (in Intellij)

yes see there that info right there for server thread info in the console that’s different :slight_smile: that’s what i’m talking about :slight_smile:

Oh I didn’t even notice the grey and light blue difference before :smiley:

2 Likes

how is that coded in the Gamepreinitialization portion of a plugin? :smile: i know how to get the info logg for those…but they are more like the 20:28:38 instead of the 20:27:53 i want it to write like the 20:27 :slight_smile:

Oh those will be console color escape characters. That’s still dependent on the viewer (only some consoles)
See this list of characters http://ascii-table.com/ansi-escape-sequences.php

hahaha but how are they codded into the logger?

command prompt line…

Don’t know. I have never seen that in Eclipse or in Windows Command Prompt. It’s specific to certain consoles

I guess you could try sending a formatted text object to the console (this will not add it to the log file though)

Sponge.getGame().getServer().getConsole().sendMessage(Texts.of(/*message*/));
1 Like

that’s it!!! awesome thank you !!!