adobe-photoshop/generator — pull request #94 by joelrbrandt (2013-08-22 22:11:33+00:00)
Title: add ability to configure log output and levels

This pull requests does a number of things:
- It overrides console.log/info/warn/error/dir to (optionally) supress output
- Provides a way to set log levels that are actually writted to stdout/stderr
- Provides a way to configure the logger from a generator config file.

The config options go in a "logging" section of the config file. The options are:

* **keep** -- boolean specifying whether to also create a timestamped log in the log dir (in addition to _latest) -- defaults to false
* **level** -- one of "log", "dir", "info", "warn", "error", sets the log level -- defaults to "error"
* **logfile** -- optional path to an additional log file, resolved against the default log dir if a relative path -- defaults to null

Here's some simple JS that can be used to test this (place in same dir as generator-core's app.js):

```javascript
(function () {
"use strict";

var stdlog = require("./lib/stdlog");

stdlog.setup({
vendor: "Adobe",
application: "Adobe Photoshop CC",
module: "Generator",
level: "error"
});

var config = require("./lib/config").getConfig();

stdlog.processConfig(config.logging);

console.log("a log");
console.info("an info");
console.warn("a warn");
console.error("an error");
console.dir({a : "dir"});

console.log("setting log level to warn");
stdlog.setLogLevel("warn");

console.log("another log -- should not appear");
console.info("another info -- should not appear");
console.warn("another warn");
console.error("another error");
console.dir({a : "dir that should not appear"});

}());
```

And, here's a simple config file (name generator.json in same dir as app.js):

```json
{
"logging" : {
"keep" : false,
"level" : "log",
"logfile" : "/Users/jbrandt/Desktop/mylog.txt"
}
}
```