aliens

Author Topic: Increase script debug log limit  (Read 345 times)

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 142
  • Sorry for my bEd English
    • View Profile
Increase script debug log limit
« on: December 12, 2024, 11:49:20 am »
Is there any way to increase the number of lines available for logging scripts (by script function “debug_log”)? 500 lines is very small for me :)

Also, is there a setting that would clear the entire openxcom.log file when the game reloads the data (for example, when changing the set of activated mods and pressing the OK button) without quitting the game and starting the OpenXcomEx.exe file again?

If these settings do not exist, is it possible to add them?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3374
    • View Profile
Re: Increase script debug log limit
« Reply #1 on: December 12, 2024, 12:02:37 pm »
Main reason I add this 500 limit was that I put `debug_log` in wrong place and whole game crawl to a halt when logs gets floods with hundreds of debug messages.
This means this limit is needed, question is what is exactly your use case when current limit is not enough?

For clearing logs, I think some thing could be added here as hidden user option.

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 142
  • Sorry for my bEd English
    • View Profile
Re: Increase script debug log limit
« Reply #2 on: December 12, 2024, 12:45:26 pm »
Using the script “createUnit” I set special parameters (using a random number generator) for all units (and additionally for the player's soldiers via “applySoldierBonuses”) in tags, so in the log I need to know what parameters were given to these units and what their values are.
Then, using the scripts “skillUseUnit”, “hitUnit”, “healUnit” and “damageUnit” I need to see what changes are happening based on the parameters given to the units.
Moving to a new turn partially changes the parameters of the units - and I need to see that too.

I realize that displaying “debug_log” in scripts that are activated every frame is a very bad idea. Though for understanding some peculiarities of scripts work I did that once :)

In my opinion, the option for the number of lines for the scripts debugger should be invisible to the average player, but available in the options.cfg file for mod developers. And if the developer in this setting will put any inadequate values - it's his personal problems. He should use this setting wisely and do not output data in the log every frame :)

Here for example is a small part of my last log:
Code: [Select]
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "11 Martial artist-3" id: 11 faction: Player hp: 41/41) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) has UNIT_MEDAL_MARTIAL_ARTIST level 4
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "13 Martial artist-5" id: 13 faction: Player hp: 46/46) has UNIT_MEDAL_MARTIAL_ARTIST level 5
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "13 Martial artist-5" id: 13 faction: Player hp: 46/46) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "14 Martial artist-6" id: 14 faction: Player hp: 51/51) has UNIT_MEDAL_MARTIAL_ARTIST level 6
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "14 Martial artist-6" id: 14 faction: Player hp: 51/51) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "15 Martial artist-7" id: 15 faction: Player hp: 54/54) has UNIT_MEDAL_MARTIAL_ARTIST level 7
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "15 Martial artist-7" id: 15 faction: Player hp: 54/54) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "16 Martial artist-8" id: 16 faction: Player hp: 58/58) has UNIT_MEDAL_MARTIAL_ARTIST level 8
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "16 Martial artist-8" id: 16 faction: Player hp: 58/58) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "17 Martial artist-9" id: 17 faction: Player hp: 60/60) has UNIT_MEDAL_MARTIAL_ARTIST level 9
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "17 Martial artist-9" id: 17 faction: Player hp: 60/60) has UNIT_MEDAL_RANGER level 4
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "17 Martial artist-9" id: 17 faction: Player hp: 60/60) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "18 Martial artist-10" id: 18 faction: Player hp: 63/63) has UNIT_MEDAL_MARTIAL_ARTIST level 10
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "18 Martial artist-10" id: 18 faction: Player hp: 63/63) has UNIT_MEDAL_RANGER level 4
[12-12-2024_11-54-56] [DEBUG] Script debug log: applySoldierBonuses-1: Soldier BattleUnit(type: "SOLDIER" name: "18 Martial artist-10" id: 18 faction: Player hp: 63/63) has 1 SPEC_MARTIAL_ARTIST specialisation
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000000 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 1
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000001 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 10
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000002 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 10
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000003 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 2
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000004 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 4
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000005 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 4
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000006 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 7
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000007 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 2
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000008 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 11
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000009 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 1
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000010 faction: Hostile hp: 30/30) has 3 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 10
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_GUARDIAN" race: "STR_SECTOID" id: 1000011 faction: Hostile hp: 30/30) has 7 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 3
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_MEDIC" race: "STR_SECTOID" id: 1000012 faction: Hostile hp: 30/30) has 5 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 6
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_ENGINEER" race: "STR_SECTOID" id: 1000013 faction: Hostile hp: 30/30) has 6 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 7
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_ENGINEER" race: "STR_SECTOID" id: 1000014 faction: Hostile hp: 30/30) has 6 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 12
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_LEADER" race: "STR_SECTOID" id: 1000015 faction: Hostile hp: 30/30) has 7 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 2
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50: Unit BattleUnit(type: "STR_SECTOID_LEADER" race: "STR_SECTOID" id: 1000016 faction: Hostile hp: 30/30) has 7 intelligence and 100 % chance to get skill:
[12-12-2024_11-54-56] [DEBUG] Script debug log: createUnit-50:    and can use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill level 3
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) has MARTIAL_ARTIST specialisation with 4 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "13 Martial artist-5" id: 13 faction: Player hp: 46/46) has MARTIAL_ARTIST specialisation with 5 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "14 Martial artist-6" id: 14 faction: Player hp: 51/51) has MARTIAL_ARTIST specialisation with 6 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "15 Martial artist-7" id: 15 faction: Player hp: 54/54) has MARTIAL_ARTIST specialisation with 7 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "16 Martial artist-8" id: 16 faction: Player hp: 58/58) has MARTIAL_ARTIST specialisation with 8 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "17 Martial artist-9" id: 17 faction: Player hp: 60/60) has MARTIAL_ARTIST specialisation with 9 skill level
[12-12-2024_11-55-09] [DEBUG] Script debug log: newTurnUnit-8: Soldier BattleUnit(type: "SOLDIER" name: "18 Martial artist-10" id: 18 faction: Player hp: 63/63) has MARTIAL_ARTIST specialisation with 10 skill level
[12-12-2024_11-56-14] [DEBUG] Script debug log: hitUnit-1.1: Unit BattleUnit(type: "STR_SECTOID_LEADER" race: "STR_SECTOID" id: 1000015 faction: Hostile hp: 30/30) try to use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill (level 2 ) on target BattleUnit(type: "SOLDIER" name: "11 Martial artist-3" id: 11 faction: Player hp: 41/41) :
[12-12-2024_11-56-14] [DEBUG] Script debug log: hitUnit-1.1:    and can dealt [ 100 .. 116 ]% of 123 damage
[12-12-2024_11-56-14] [DEBUG] Script debug log: hitUnit-1.1:       and do 104 % of damage -> 127 damage
[12-12-2024_11-56-51] [DEBUG] Script debug log: hitUnit-1.1: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000010 faction: Hostile hp: 29/30) try to use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill (level 10 ) on target BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) :
[12-12-2024_11-56-51] [DEBUG] Script debug log: hitUnit-1.1:    and can dealt [ 100 .. 140 ]% of 56 damage
[12-12-2024_11-56-51] [DEBUG] Script debug log: hitUnit-1.1:       and do 104 % of damage -> 58 damage
[12-12-2024_11-56-53] [DEBUG] Script debug log: hitUnit-1.1: Unit BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) try to use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill (level 4 ) on target BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000010 faction: Hostile hp: 29/30) :
[12-12-2024_11-56-53] [DEBUG] Script debug log: hitUnit-1.1:    and can dealt [ 100 .. 139 ]% of 20 damage
[12-12-2024_11-56-53] [DEBUG] Script debug log: hitUnit-1.1:       and do 133 % of damage -> 26 damage
[12-12-2024_11-58-09] [DEBUG] Script debug log: hitUnit-1.1: Unit BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) try to use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill (level 4 ) on target BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000010 faction: Hostile hp: 7/30) :
[12-12-2024_11-58-09] [DEBUG] Script debug log: hitUnit-1.1:    and can dealt [ 100 .. 139 ]% of 31 damage
[12-12-2024_11-58-09] [DEBUG] Script debug log: hitUnit-1.1:       and do 110 % of damage -> 34 damage
[12-12-2024_11-58-39] [DEBUG] Script debug log: hitUnit-1.1: Unit BattleUnit(type: "STR_SECTOID_SOLDIER" race: "STR_SECTOID" id: 1000001 faction: Hostile hp: 30/30) try to use passive 11 MARTIAL_ARTIST_BLADE_MASTER skill (level 10 ) on target BattleUnit(type: "SOLDIER" name: "12 Martial artist-4" id: 12 faction: Player hp: 43/43) :
[12-12-2024_11-58-39] [DEBUG] Script debug log: hitUnit-1.1:    and can dealt [ 100 .. 140 ]% of 153 damage
[12-12-2024_11-58-39] [DEBUG] Script debug log: hitUnit-1.1:       and do 135 % of damage -> 206 damage
« Last Edit: December 12, 2024, 12:51:14 pm by Kozinsky »

Online Delian

  • Commander
  • *****
  • Posts: 547
    • View Profile
Re: Increase script debug log limit
« Reply #3 on: December 12, 2024, 01:24:10 pm »
Do you know why debug logging is slow?

Because the current implementation is inefficient. Every time you write to the log, it opens the log file and closes the log file. This file opening and file closing is what kills the logging performance.