HearthStats/HearthStats.net-Uploader — pull request #215 by gtch (2014-03-20 05:03:57+00:00)
Title: Improved logging and OS X Notifications support

I've made a couple of changes to the HearthStats.net Uploader:
* Improved logging
* Support for OS X Notifications (Mac only)
* Moved location of config files (Mac only)

## Improved logging

This is the logging I suggested in #195. It has a few features:
* Lots more control over the logging, so developers can enable detailed debug logs
* Adds system information to log.txt and other details like time and thread:
```
22:11:25.820 [ main] INFO net.hearthstats.Main - **********************************************************************
22:11:25.823 [ main] INFO net.hearthstats.Main - Starting HearthStats.net Uploader 0.15.201403121 on OSX
22:11:25.824 [ main] INFO net.hearthstats.Main - os.name=Mac OS X
22:11:25.824 [ main] INFO net.hearthstats.Main - os.version=10.9.2
22:11:25.825 [ main] INFO net.hearthstats.Main - os.arch=x86_64
22:11:25.825 [ main] INFO net.hearthstats.Main - java.runtime.version=1.7.0_51-b13
22:11:25.825 [ main] INFO net.hearthstats.Main - java.class.path=/Users/test/IdeaProjects/HearthStats.net-Uploader/build/HearthStats.app/Contents/Java/Classes:/Users/test/IdeaProjects/HearthStats.net-Uploader/build/HearthStats.app/Contents/Java/HearthStatsUploader-OSX.jar
22:11:25.825 [ main] INFO net.hearthstats.Main - user.language=en
22:11:25.825 [ main] INFO net.hearthstats.Main - **********************************************************************
```
* Error are handled better: they're highlighted in red in the app log, and full exception stack traces are written to log.txt:
![log-error](https://f.cloud.github.com/assets/1667484/2469020/aa942a8a-afea-11e3-97e4-4be5a9425e7e.png)
* It's now relatively easy to apply unique formatting to each event, for example I've put a dividing line between matches and made the match result a little more prominent:
![log-result](https://f.cloud.github.com/assets/1667484/2469022/cc14165c-afea-11e3-8453-ef9a47dcc829.png)

The formatting is controlled by applog.css. Java's CSS support is pretty limited but it's good enough to allow most types of formatting that you might want. Feel free to get more creating with the formatting of the logs...

I've written a brief guide on how to enable debug logging at https://github.com/gtch/HearthStats.net-Uploader/wiki/Customising-Logging for anyone who want to help develop and debug.

## Support for OS X Notifications

On a Mac (running OS X Mountain Lion or later) the OS X Notification Centre will be used instead of the custom Java one, as requested by #176. This has the big advantage that it works in full-screen mode, whereas the Java one doesn't, so I've made it the default for OS X. Users can switch back to the old one if they prefer, and of course Windows will continue to use the existing one.

The OS X notifications look like this:
![notification](https://f.cloud.github.com/assets/1667484/2469057/082f3666-afec-11e3-9493-308dbc28aa7b.png)

## Moved location of config files

In response to #177 I've moved the location of the config and temp files in OS X to meet Apple standards. This shouldn't affect Windows in any way.

These files are now stored in the user's Application Support folder:
* the log file
* OCR images
* updates

This file is now stored in the user's Preferences folder:
* the config.ini file (though renamed to net.hearthstats.HearthStatsUploader.ini to meet Apple standards)

No files are written to /tmp or the user's home folder any more, so the HearthStats.net Uploader is now a well-behaved Mac app!