herbou / Unity_Logger

Show console messages inside the game in Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to include TimeStamps and auto-scroll down?

cafigz opened this issue · comments

Hi there! I love this logger and have been using it for months in my projects.
I just wanted to ask you if it's possible to add time stamps for the logs like in the example: (just so I'm able to know what time it was)
image

Also I wanted to have auto-scroll down, whenever a new message appears.

Thanks in advance! :D

If anyone wants to add the time just do this to the LogCallback method:

DateTime date = DateTime.Now;
uiLogText.text += $"{date.Hour}:{date.Minute}:{date.Second}
private void LogCallback(string message, string stackTrace, LogType type)
        {
            //logTypeIndex => normal:0 , warning:1 , error:2
            int logTypeIndex = (type == LogType.Log) ? 0 : (type == LogType.Warning) ? 1 : 2;
            DateTime date = DateTime.Now;
            uiLogText.text += $"{date.Hour}:{date.Minute}:{date.Second} | <sprite={logTypeIndex}><color={colors[logTypeIndex]}> {message}</color>\n\n";
            ScrollDown();
        }

image

Thanks, that's what I did :D
Do you know how can I have the logger automatically scroll down, whenever a new message appears?