mleku @mleku - 5d
#devstr #lifehack i have finally found a way to have the tilix paning terminal emulator fully let me have log code locations in my logs and set them up so that i can click on the relative file path, so long as i am in the directory of teh source code (even if running it remotely) and jump straight to the line of code where the log was printed from: create a script called `setcurrent` in your PATH ( eg ~/.local/bin/setcurrent ) #!/usr/bin/bash echo $(pwd) > ~/.current set the following environment variable in your ~/.bashrc PROMPT_COMMAND='setcurrent' using the following regular expressions, replacing the path as necessary, and setting perhaps a different program than ide (this is for goland, i use an alias to the binary) ^((([a-zA-Z@0-9-_.]+/)+([a-zA-Z@0-9-_.]+)):([0-9]+)) ide --line $5 $(cat /home/mleku/.current)/$2 [ ]((([a-zA-Z@0-9-_./]+)+([a-zA-Z@0-9-_.]+)):([0-9]+)) ide --line $5 $(cat /home/mleku/.current)/$2 ([/](([a-zA-Z@0-9-_.]+/)+([a-zA-Z@0-9-_.]+)):([0-9]+)) ide --line $5 /$2 and so long as you use this with an app containing /lol/log.go as this one is, this finds that path and trims it off from the log line locations and in tilix you can click on the file locations that are relative to the CWD where you are running the relay from. if this is a remote machine, just go to the location where your source code is to make it work. i put this note above in the source code of my logger, i have got fed up with the complexity of #realy and am rebuilding it from scratch... of course not from scratch, but copypasta from one side to the other, but building the frame of it carefully first so it's crispy clean
also, adjunct to that, in the logger i figured out that since i know the number of characters in the filename of the logger package itself, i can assign a variable with the trimmed off part so i can split the string on it and only print the relative path works very nice, i wish it was standard but there is some dumb memes around log printing... i rely on good logs to debug my code, you can't fix what you can't see...
probably this comes from having dealt with so much shitty code... btcd, btcwallet, khatru, eventstore, relayer yeah, today i'm starting a total cleanup of #realy figured out some better ways to do things like the short names for the loggers (put em in their own damn packages) and the trick above so i can have more neat logs (this is gonna be really helpful with my paid gig too, saving a lot of time and headache while keeping my readable code)