## 4.4. Logging

A useful feature of KildClient is it hability to log all the output from the MUD, as shown in the screen, so that you can retrieve it later.

The output is saved in a file you specify. ANSI color codes are not saved, but otherwise the output is identical.

It is possible to prefix each line with a timestamp, so you can see when each line was received. You can specify the format of this timestamp.

The figure below shows the Logging section of the World Editor:

Figure 4.6. The Logging section of the World Editor

In the top, you will see if logging is currently enabled or disabled, and you can quickly start or stop it with the two buttons.

When you start logging, you can include some of the lines that have already been received and are in the scrollback buffer displayed in the main window. If you want to do that, just select the corresponding check box and enter the number of lines to save.

Next you specify the name of the file to store the log. New log lines are appended to that file, so it is safe so specify an existing file.

It is possible to have the log file named automatically based on the date and time that logging is started. For example, if the file name is "`log_%m_%d.txt`" the file name will include the month and day, for example for November 25th the file will be "`log_11_25.txt`". This is done replacing escape sequences beginning with the `%` character for the values depending on the date and time. The valid escape sequences are those of the `strftime()` function, and can be found here.

Similarly, you can use `%Kw` in the file name and it will be replaced by the name of the World. And the string `%Kc` is replaced by the name of the character used in auto-login (see Section 4.1, “General”). (If auto-login was not used, then `%Kc` is replaced by an empty string.)

Parent directories are created automatically if necessary when opening log files.

If Automatically start logging when connected is selected, then all your mud sessions will be logged automatically.

It is possible to prefix each line written in the log file with the date and time it was received. To do that, select Prefix lines with date and/or time, and specify the format of the date and time. This is also a string with `%` escape sequences like the file name. The default includes the full date and time.