Improve logging format.

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
Cjkjvfnby
AI Contributor
Posts: 452
Joined: Tue Jun 24, 2014 9:55 pm

Improve logging format.

#1 Post by Cjkjvfnby » Sun Jul 01, 2018 11:55 am

I want to raise my problem about logs. Technical information is taking too much place in it.

Code: Select all

03:20:08.797923 [debug] python : MoveUtilsAI.py:74 - Found valid path: path_information(distance=118.954092775184, fuel=4.0, path=(903, 843))
03:20:08.797923 [debug] python : MoveUtilsAI.py:59 - Requesting path for fleet F_1011<Scout Fleet> from S_903<Elased β> to S_828<Elased γ>
03:20:08.798923 [debug] python : MoveUtilsAI.py:74 - Found valid path: path_information(distance=91.80438210808126, fuel=4.0, path=(903, 828))
03:20:08.798923 [debug] python : MoveUtilsAI.py:59 - Requesting path for fleet F_1011<Scout Fleet> from S_903<Elased β> to S_288<>
03:20:08.798923 [debug] python : MoveUtilsAI.py:74 - Found valid path: path_information(distance=110.53160699667686, fuel=4.0, path=(903, 288))
03:20:08.798923 [debug] python : MoveUtilsAI.py:59 - Requesting path for fleet F_1011<Scout Fleet> from S_903<Elased β> to S_843<>
03:20:08.798923 [debug] python : MoveUtilsAI.py:74 - Found valid path: path_information(distance=118.954092775184, fuel=4.0, path=(903, 843))
03:20:08.798923 [debug] python : ExplorationAI.py:115 - Remaining options: [(1, 1011, 288), (1, 1011, 828), (1, 1011, 843), (1, 1017, 288), (1, 1017, 828), (1, 1017, 843)]
03:20:08.799923 [info] python : ExplorationAI.py:119 - Sending fleet 1011 to explore S_288<>
Image how much of the useful text fits 23" screen with comfort font size for me is in attachment.

I see next ways to make technical info shorter:
  • Use milliseconds instead of microseconds.

    Code: Select all

    03:20:08.797923 [debug] python : MoveUtilsAI.py:74 -
    03:20:08.797 [debug] python : MoveUtilsAI.py:74 -
    
  • Remove some separators.

    Code: Select all

    03:20:08.797923 [debug] python : MoveUtilsAI.py:74 -
    03:20:08.797923[debug]python MoveUtilsAI.py:74 
    
  • Remove `channel_name` or make it optional. In quick look it almost always duplicates filename. For python it is too broad.

    Code: Select all

    03:20:08.798923 [debug] python : MoveUtilsAI.py:59
    03:20:08.798923 [debug] MoveUtilsAI.py:59
    
Result:

Code: Select all

03:20:08.797923 [debug] python : MoveUtilsAI.py:74 - Found valid path: path_information(distance=118.954092775184, fuel=4.0, path=(903, 843))
03:20:08.797[debug] MoveUtilsAI.py:74 Found valid path: path_information(distance=118.954092775184, fuel=4.0, path=(903, 843))
Attachments
logs_small.png
Sublime text 3, 1920*1080, 23" comfort size
logs_small.png (198.27 KiB) Viewed 172 times
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply