emorrp1 / mintupload

Uploads files on the Internet
http://emorrp1.github.com/mintupload
6 stars 21 forks source link

log urls #11

Closed emorrp1 closed 15 years ago

emorrp1 commented 15 years ago

I just thought it would be a cool idea to log all the uploads (optionally, of course) That way:

1) If you close the window before you've actually copied it, you can find it again (e.g. you copied some other text in the meantime) 2) If you want to share the link again with someone else, but can't remember where you posted the original link (or it it was in IRC etc.) you can (provided you remember the filename)

emorrp1 commented 15 years ago

Include expiration dates (where appropriate) - http://forums.linuxmint.com/viewtopic.php?f=29&t=16982&p=111683&hilit=mintupload#p111683

kinkerl commented 15 years ago

do you have an idea how to store/log the informations? maybe xml oder plain text? i think only 4 attributes are relevant: "date/time" the "target url" and maybe the local filename and the server expiration of the file plaintext or xml? maybe xml is overkill?

first drafts of the log design: plaintext: uploadtime exstimatedserverexpiration remotefilename localfilename yyyymmdd-hhmmss yyyymmdd-hhmmss http://theurltothefile /local/path

xml:

<uploads>
   <upload>
   <local year="2009" month="6" day="17" hour="" min="" sec="" url="" />
   <remote year="2009" month="6" day="17" hour="" min="" sec="" url="" />
   </upload>
</uploads>
emorrp1 commented 15 years ago

Ok, a few things: 1) Threading causes issues, we have to deal with log locks and stuff, so don't rush into it (should be easy enough to put at end, with one of the .wait() functions for a logging class) See also how mintUpdate does its logging (rather than re-inventing the wheel)

2) whitespace-separated is better for python (a simple .split() on each line), xml is really too restrictive.

3) the date-time format should be configurable from the start (but not linked to the upload path date-time, though it should use the same timestamp)

4) I think the amount of detail you're suggesting is a bit overkill, I was thinking:

UploadDateTime Filename URL Service ExpirationDateTime (Filepath?)

Remotefilename is useless (or can be derived from URL) Localpath unlikely to be needed, but seeing as the info's available, may as well.

kinkerl commented 15 years ago

this feature is next on my todo list this week if everything goes as planed.

kinkerl commented 15 years ago

ok i looked at the logging in mintupdate. the logging is really simple: open(filename) and writes + flushs.

i would suggest using the log library i used in persy. its threadsave and THE way of logging in python. it supports logging levels and everything you want in such a lib... and its threadsave.

i will talk to clem about this... i think mintupdate should use this too

emorrp1 commented 15 years ago

Have added your logging system to community, I plan on reorganising it into a mintLogger class that can also be added as a CustomError handler (I'm also thinking of renaming that to mintError, and encouraging the use of these base classes in other mintTools)

emorrp1 commented 15 years ago

closing now the infrastructure exists, even if I'm going to tweak it.