scottrice / Ice

Application to automatically add ROMs to Steam
http://scottrice.github.io/Ice/
MIT License
835 stars 96 forks source link

Change how Ice does logging so logs are writable #347

Closed mdeguzis closed 8 years ago

mdeguzis commented 8 years ago

This involves work that @sharkwouter has done on the old [ice_logging.py](https://github.com/ProfessorKaos64/Ice/blob/brewmaster/ice/ice_logging.py) file, which seems to my now logs.py and __main__.py. If there is a middle-ground that can be found so logging goes to a temporary (such as /tmp on Linux OS's) or the users home path, that would be ideal.

Thoughts?

scottrice commented 8 years ago

so logs are writable

Is this the goal of the task, to put them in a location thats writable? Ah, that makes sense, since you guys are bundling Ice its probably sitting in a read only directory right now isnt it.

That seems totally fine to me, although if you guys dont have a preference then I think I will probably put them in paths.application_data_directory(), which (if I understand the appdirs module correctly) would cause it to be places in ~/.local/share/Ice. Does that seem reasonable to you?

mdeguzis commented 8 years ago

That would work. @sharkwouter , any objections or suggestions? In a compromise, it would have to be a location that each OS can understand, hence the module.

sharkwouter commented 8 years ago

Sounds like a good solution.

Some documentation updates would be required, though.

scottrice commented 8 years ago

Still want to make a way of easily sending logs before I close this.

mdeguzis commented 8 years ago

Why not just integrate pastebin or something into the CLI to send the logs on command or on a, something like "ice --debug" then when it closes sends them. A universal way to do this, among many systems, is something like what http://sprunge.us/ does:

sprunge(1)                          SPRUNGE                          sprunge(1)

NAME
    sprunge: command line pastebin.

SYNOPSIS
    <command> | curl -F 'sprunge=<-' http://sprunge.us

DESCRIPTION
    add ?<lang> to resulting url for line numbers and syntax highlighting
    use this form to paste from a browser

EXAMPLES
    ~$ cat bin/ching | curl -F 'sprunge=<-' http://sprunge.us
       http://sprunge.us/aXZI
    ~$ firefox http://sprunge.us/aXZI?py#n-7

SEE ALSO
    http://github.com/rupa/sprunge

As far as I know, curl is available on all main platforms.

scottrice commented 8 years ago

@ProfessorKaos64 Thats a fantastic idea. That would make things much easier, and kill two birds with one stone. I'll do that.

mdeguzis commented 8 years ago

@scottrice , this still seems to be an issue. Tested another build today with your latest commit:

Get:1 http://packages.libregeek.org/SteamOS-Tools/ brewmaster/games ice-unstable all 0.1.0+1cc2e64+bsos1-1 [46.8 kB]
Fetched 46.8 kB in 0s (92.1 kB/s)     y
(Reading database ... 144446 files and directories currently installed.)
Preparing to unpack .../ice-unstable_0.1.0+1cc2e64+bsos1-1_all.deb ...
Unpacking ice-unstable (0.1.0+1cc2e64+bsos1-1) over (0.1.0-1+d04e7fe+1) ...
Setting up ice-unstable (0.1.0+1cc2e64+bsos1-1) ...
Installing new version of config file /etc/ice/config.txt ...
desktop@steamos:~/SteamOS-Tools-Packaging/ice$ sudo systemctl stop lightdm
desktop@steamos:~/SteamOS-Tools-Packaging/ice$ su - steam
Password: 
steam@steamos:~$ ice-launcher 
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/share/games/ice/__main__.py", line 19, in <module>
    with open('error.log', 'w') as f:
IOError: [Errno 13] Permission denied: 'error.log'

Your commit references pastebin module additions, but I don't see code to write logs to an area that the steam user can reach. I would say logs should be written to a central location users can get to, not in the running directory as it still seems above.