Skip to content

How to control the logs output stream

Deyan Dobromirov edited this page Jun 26, 2024 · 39 revisions

What is the purpose of the log stream in the first place and why do I need it?

Logging stream is a general feature in every program, which shows the interpreter/compiler logical path followed when various conditions are met during the execution. It is often used to show status and/or output data flow of an API function and it represents a bunch of messages that are sent to various stream outputs ( console or file ), displaying the program current status. It must not affect the logical execution path of the program or data flow. This means your tracks will be connected the same way with or without logs enabled.
Note: Logging stream will impact the tool performance, so make sure you disable the feature if you do not need to check or debug something out. Only the admin will have access to enable or disable the logging steam control.

Which are the variables controlling the logging stream?

Note: You can also control these values from the utilities admin panel.
This is done using the console variables below:

  • trackassembly_logsmax This contains the maximum value of the message counter updated on every log call. The value is incremented after every message displayed. A proper value for this log control variable is 10000 to 30000, keeping the stream in a reasonable length.
    Note: When you enable the file stream, it tells the logging feature how many message lines to output before the log file gets deleted by applying the length control keeping it in reasonable size.
  • trackassembly_logfile This controls whenever the log stream should be printed in the console when 0 is written or the stream should go to data/trackassembly/trackasmlib_log.txt when 1 is written. The value is converted to boolean and cached automatically.

How to enable the logging stream for debug purposes?

  1. Open the console using the ` under the ECS key.
  2. Paste trackassembly_logsmax 10000 and hit enter to set the maximum log lines in the file
  3. Paste trackassembly_logfile 1 and hit enter to enable this log file to stream into.
  4. Paste trackassembly_devmode 1 and hit enter to enable the developer mode
  5. On the server in-game hit RELOAD on the world ( def. R ) for multiplayer or the memory settings button in utilities
  6. On the client in-game while you are in the menu, shift-right-click the memory settings button in utilities administrator menu
  7. Paste trackassembly_devmode 0 and hit enter to disable the developer mode

How to disable the logging stream for faster execution?

  1. Open the console using the ` under the ECS key.
  2. Paste trackassembly_logsmax 0 and hit enter to set the maximum log lines in the file
  3. Paste trackassembly_logfile 0 and hit enter to disable this log file to stream into.
  4. Paste trackassembly_devmode 1 and hit enter to enable the developer mode
  5. On the server in-game hit RELOAD on the world ( def. R ) for multiplayer or the memory settings button in utilities
  6. On the client in-game while you are in the menu, shift-right-click the memory settings button in utilities administrator menu
  7. Paste trackassembly_devmode 0 and hit enter to disable the developer mode

What will the log stream show when it is enabled?

It will just print a bunch of log messages in the following format:
<ID> [<date> <time>] <message_instance> > <tool_name> [<database_mode>] <function_name>: <message>

How can the user control which log messages can show up and which will not?

You can easily do that by creating settings for the logs. These are nothing more than
text files, where contents are matched to the logs you want to skip. The path that you
must create these files in is located here: data/trackassembly/set/trackasmlib_sl<suffix>.txt
There are the types of logging settings, where the file <suffix> matches it with down casing:

  • skip (trackasmlib_slskip.txt): If a log message is found persisting in this list, it won't show in the output (a.k.a blacklisted). This is good when a function is called many times and floods
  • only (trackasmlib_slonly.txt): All other log messages will be blocked besides the ones in this list (a.k.a only ones whitelisted) This is good when you want to see only one single thing

These are mine if you want to take a look at how to create one.