Storage log filename irregularities

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderators: Moderators, Developers

Message
Author
User avatar
ChrstphrR
Testers Team
Testers Team
Posts: 42
Joined: 09 May 2010, 17:30
Noob?: No
Location: Northern Alberta, Canada

Storage log filename irregularities

#1 Post by ChrstphrR »

Preamble
Running off of r7686 on SVN, but this bug/oddity has been around for quite some time.

When using "storage log" at the console, your account's storage items as they were last seen are recorded, with a filename structure that, at first, appears to be:

Code: Select all

storage_<AccountName>_<CharacterSlotNumber>.txt
This is, of course, stored wherever you have your logs pointed to either as a command line parameter, or in your config.

Discrepencies:

When starting with one character (either at the console, or by config), and then switching to others while connected in a session with the server, the file for storage will change, with further account name - character number pairs appended to the filename:

Code: Select all

conf char 0
relog 10
...
<access kafra babe here to get to storage>
storage
storage log

conf char 1
relog 10
...
<access kafra babe here to get to storage>
storage
storage log

conf char 2
relog 10
...
<access kafra babe here to get to storage>
storage
storage log
Storage logs created, in succession, from this sequence, assuming a character account "foobar":

Code: Select all

storage_foobar_0.txt
storage_foobar_0_foobar_1.txt
storage_foobar_0_foobar_1_foobar_2.txt
My recall of combinatorics are weak now, but it looks like, given there are up to 9 slots on most servers, there is the potential to have around 100 storage log files if you were to try all combinations and variations. The exact number of potential logfiles that could be created will be left as an exercise for the readers. }:)

Suggested solution

Given that storage is common for the account (on the same server), the character slot number is simply not needed in the filename when logging to file.

Storage for character 0 is the same for characters 1-8, too.

Instead of having a potential dozens to hundreds of combinations of different file names, I would suggest just logging storage using filename form that is simpler than the current:

Code: Select all

storage_<AccountName>.txt
This simpler form reflects that storage is account bound, not character bound, and sidesteps the erred logic that can result in dozens of storage log files.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Storage log filename irregularities

#2 Post by EternalHarvest »

ChrstphrR wrote:I would suggest just logging storage using filename form that is simpler than the current:

Code: Select all

storage_<AccountName>.txt
This simpler form reflects that storage is account bound, not character bound, and sidesteps the erred logic that can result in dozens of storage log files.
Agree.

That's why this happens:

Code: Select all

$logAppend = ($config{logAppendUsername}) ? "_$config{username}_$config{char}" : '';

if ($config{logAppendUsername} && index($Settings::storage_log_file, $logAppend) == -1) {

	$Settings::storage_log_file  = substr($Settings::storage_log_file, 0, length($Settings::storage_log_file) - 4) . "$logAppend.txt";

}

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Storage log filename irregularities

#3 Post by kLabMouse »

Agree.
Should be fixed.

Locked