Adjustment for scoping

The code was wrapped in two anonymous functions, which could cause `this` to be undefined depending on how the loglevel code was included in a project. 

Only using one anonymous function and having this be at the "top-level" allows the code to be wrapped and invoked with apply like so:

```javascript
var myScope = {}:
(function(){
 // loglevel.js source
 // "this" will equal myScope, since the "this" in loglevel.js is in this scope.
}).apply(myScope);
myScope.log.debug("log was defined on myScope");
```

The code change follows the same pattern as this:
https://github.com/marionettejs/backbone.marionette/blob/master/src/build/marionette.core.js

I'd love to write a unit test but I'd have to adjust the `Gruntfile.js` and include grunt-preprocess or grunt-rigger, which are code injection/include tools, to generate a test that includes the `loglevel.js` wrapped in a function invoked with apply. If you want me to do this I will. 

I also hope that my change doesn't affect anything that the `undefined` argument was doing.
https://github.com/pimterry/loglevel/blob/master/lib/loglevel.js#L8

Thanks,
Gianni
The tests failed for me right when I checked out the project. And I put this QUnit change in my first commit, before I made any of my changes. 

QUnit wasn't defining a global log function for me. I defined my own to mimic what you were testing and make sure noConflict worked as expected. 

I thought it was strange that the tests were failing with a fresh checkout. We'd have to investigate further to figure out why that happened. Maybe somehow my tests ran with a different version of QUnit.

Sent from my iPhone

> On Aug 14, 2014, at 4:20 AM, Tim Perry <notifications@github.com> wrote:
> 
> In test/test-qunit.html:
> 
> > @@ -6,6 +6,12 @@
> >  	<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
> >  </head>
> >  <body>
> > +    <script>
> > +    	// log function to test noConflict.
> > +		function log(){
> > +			return "isOriginalLog";
> > +		}
> The reason this test is here is only because QUnit creates a global log, which conflicts with loglevel. You having to change this suggests maybe your changes are messing with that in some way or another? It should be possible to make this test work using QUnit.log I think, so I think this definitely needs looking at. #48 has some more details
> 
> —
> Reply to this email directly or view it on GitHub.