Feature - Rejected use subfolders for session logs

taltamir

Member
The session log folder can get bogged down with quite a lot of items to scroll through, especially over multiple years of regular play alongside multiple accounts. I think it would be great if it used subfolders. Thus instead of storing everything in:
/mafia/sessions/

store it in:
/mafia/sessions/NAME/YEAR/

Where:
NAME = name of account
YEAR = year of that log. For example 2018

or maybe the other way around?
/mafia/sessions/YEAR/NAME/
 
Last edited:
I could see the case for grouping by name, so you can easily split out different multies, but grouping by year just seems arbitrary and pointless.
They are all marked with their dates so you can sort them by either date or by filename to easily sort them out, and most of the time you only care about the newest few (which could be a case for grouping them by week, but that gets kinda silly). Anything older than that, and you either have to remember the exact date (in which case you can just open it by name) or you're going to do some sort of search, in which case you are better off if you can filter them into a smaller period (a full year isn't particularly helpful), and/or by using some search functionality that lets you search in the files themselves. Sure, such a search could get faster if you can run it on a single year, but that assumes that: a) you know which year you are looking for. b) your search doesn't let you specify part of the filename (because then you can just input the date right there) and c) that it's a matter of life or death that you get your results a few seconds faster, given that session logs are typically very small, and thus quick to search. (If you don't do stupid stuff, like have your script get stuck in a loop printing the same statement 30000 times).

And if you want, you can always just do it yourself, it's not like it's that hard to make a map and drop a bunch of files into it once a year.
 

lostcalpolydude

Developer
Staff member
Sorting the folder by reverse date modified seems like a quick permanent solution so that you never need to scroll.
 

taltamir

Member
I could see the case for grouping by name, so you can easily split out different multies, but grouping by year just seems arbitrary and pointless.
I am glad you agree that an account name sub-folder would be useful. Even if only that gets implemented it will be a big improvement
Sorting the folder by reverse date modified seems like a quick permanent solution so that you never need to scroll.
the filename is
username_YYYYMMDD.txt

sorting by reverse date will only show the latest for a single account. If you played 3 years on 2 accounts, then showing the latest will show you todays log for account A. While account B's newest log would be 1095 files down.
While default sorting would show you the newest account A 1095 files down, and the newest for account B 2190 down.
 

lostcalpolydude

Developer
Staff member
There are probably 10 different ways to create a subfolder structure. No one will be happy with any particular choice. Plus it's probably a big hassle to make session_logs() adjust to the change. That sounds like a complete waste of time to implement.

Also, you failed at reading my post. I said to sort by date modified, not by file name.
 

taltamir

Member
Also, you failed at reading my post. I said to sort by date modified, not by file name.
Oh, I see it now.
I was just thinking about how the date is in the filename itself, which made me match what you said to what I was thinking instead of what you actually said. My mistake there, sorry.
 

fronobulax

Developer
Staff member
I support the rejection. A robust script to parse filenames and move them to sub-directories is easy in other scripting environments. Last time I did an "expand" script using bash it was about 15 lines and 15 minutes of work. But I am curious as to why this is a desired KoLmafia feature? What is the use case? What data mining are you trying to do that requires more than a couple of months of data? What questions are you trying to answer than need years of data and will have valid answers given changes in the game and KoLmafia over those years? Would it be more productive to expand your toolbox with other scripting environments that are expected to deal with file systems in ways that ash was deliberately designed not to?
 

lostcalpolydude

Developer
Staff member
I think what they wanted was an easy way to look at today's session log for a second character, which based on default sorting in most file systems would put it after all of the session logs for another character.
 

fronobulax

Developer
Staff member
I think what they wanted was an easy way to look at today's session log for a second character, which based on default sorting in most file systems would put it after all of the session logs for another character.

Possibly. But even on much maligned Windows I have my default display option set (and sticky) to use the Modified Date. Setting that took less time than this post :)

I am also presuming, based on discussion at http://kolmafia.us/showthread.php?22934-GZip-Support-for-Session-Logs&highlight=compression, there is a reason for not doing some kind of self-maintenance of the sessions directory.
 

taltamir

Member
I think what they wanted was an easy way to look at today's session log for a second character, which based on default sorting in most file systems would put it after all of the session logs for another character.
Mostly that, and I had completely forgotten I could have windows sort by date modified. Although it is not just looking at the latest logs, but sometimes older logs. For example trying to verify exactly how many neverending party rewards I had opened so far on an account.

Also OCD. I obsessively keep and organize all my documents since ever. So even if I can easily sort it, I still want it filed in proper subdirectories.

Also, I was under the impression that some scripts might want to access those logs, which would not work if they are manually moved around willy nilly.

And I also thought there would be no actual harm done by having mafia automatically separate different accounts / years, while being a very simple thing to implement. It is fairly standard for log keeping to separate by account and by year. So even if the improvement itself is minor, it doesn't cause any harm or take much effort.
 
Last edited:

fronobulax

Developer
Staff member
It is fairly standard for log keeping to separate by account and by year. So even if the improvement itself is minor, it doesn't cause any harm or take much effort.

Standard where? I have spend decades processing logs and it seems for every application that dumps all the files in one directory, there is at least one app that works better if the logs are binned in subdirectories so logs get binned before processing. Similarly if the log generatior uses sub-directories there will be at least one calculation/computation that is easier to do on all the files on a directory than to do in separate directories and merge.

A lot of people think something might be easy, and often it is, until they are reminded of a requirement that the old way and the new way have to peacefully coexist. So if we change the standard so that logs are written to different directories, session_logs() (for example) has to look in several places as well as sessions. Do we include utilities so KoLmafia/ash migrates everything unconditionally? Does creating/allowing new subdirectories open up a security hole that did not exist before? Etc., etc.

My OCD manifests itself by limiting redundant information. Thus if the subdirectory had the date or the character name, then the file would not. So to satisfy both of our OCD tendencies the file name and location would need to be changed :)
 
Last edited:
Top