PDA

View Full Version : Color codes support for printf



voron00
9th March 2017, 18:24
1289

https://github.com/voron00/libcod/commit/2bbb599d7cf39dfc788d2172da0a880cfb5d3f24

Note 1: Your terminal MUST support and have enabled ANSI colors.
Note 2: Same for your ssh client.
Note 3: It works for gsc_printf() function only.
Note 4: It can be disabled by setting 'colored_prints' cvar to 0.

Whiskas
9th March 2017, 18:30
I like it!

Is there any known hook to add text to every printf generated by the server?

voron00
9th March 2017, 18:45
I don't think server prints got any colors, except for chat perhaps, but chat can be easily replaced with gsc using callback_playercommand.

maxdamage99
9th March 2017, 18:54
Good idea, but all .ssh clients can show colors or only Putty?

Whiskas
9th March 2017, 19:02
I don't think server prints got any colors, except for chat perhaps, but chat can be easily replaced with gsc using callback_playercommand.

I was rather talking about adding current timestamp before printed text.

voron00
9th March 2017, 19:16
Good idea, but all .ssh clients can show colors or only Putty?

Works for putty, idk about others.


I was rather talking about adding current timestamp before printed text.

Proably doable.

IzNoGoD
9th March 2017, 20:46
Just pipe output of your process to a nodejs file that adds the timestamp for you.

Whiskas
9th March 2017, 23:12
Just pipe output of your process to a nodejs file that adds the timestamp for you.

Thanks, your reply inspired me to find out whether the Screen GNU has built-in timestamp or not. It seems that it has. (http://www.softpanorama.org/Utilities/Screen/screen_logging.shtml)