Bring 0.18.x changes into 1.0 branch

This commit is contained in:
Jonathan Lipps
2014-04-09 10:57:07 -07:00
4 changed files with 27 additions and 20 deletions
+1
View File
@@ -244,6 +244,7 @@ cases.
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "down");
scrollObject.put("element", ((RemoteWebElement) element).getId());
js.executeScript("mobile: scroll", scrollObject);
```
+20 -16
View File
@@ -22,31 +22,20 @@ var logger = null;
module.exports.init = function (args) {
var options = _.extend(defaults, {
colorize: !args.logNoColors
, timestamp: args.logTimestamp
timestamp: args.logTimestamp
, handleExceptions: true
, exitOnError: false
, json: false
});
var winstonOptions = {
console:
_.extend({
handleExceptions: true
, json: false
colorize: !args.logNoColors
, level: 'debug'
, exitOnError: false
}, options)
};
if (args.log) {
winstonOptions.file = {
filename: args.log
, colorize: false
, level: 'debug'
, maxsize: 10000000
, maxFiles: 1
, json: false
};
}
winston.addColors(colors);
winston.loggers.add('appium', winstonOptions);
logger = winston.loggers.get('appium');
@@ -57,6 +46,21 @@ module.exports.init = function (args) {
logger.transports.console.level = 'warn';
}
if (args.log) {
winstonOptions.file = _.extend({
filename: args.log
, colorize: false
, maxFiles: 1
}, options);
try {
logger.add(winston.transports.File, winstonOptions.file);
} catch (e) {
logger.info("Tried to attach logging to file " + args.log +
" but an error occurred");
}
}
if (args.webhook) {
var host = args.webhook;
var port = 9003;
+5 -3
View File
@@ -6,9 +6,8 @@ var parser = require('./parser.js')()
, fs = require('fs')
, path = require('path')
, isWindows = require('../helpers.js').isWindows()
, _ = require('underscore');
require('colors');
, _ = require('underscore')
, colors = require('colors');
process.chdir(path.resolve(__dirname, '../..'));
@@ -87,6 +86,9 @@ var main = function (args, readyCb, doneCb) {
if (args.log || args.webhook) {
rest.use(express.logger({stream: winstonStream}));
}
if (args.logNoColors || args.log) {
colors.mode = "none";
}
rest.use(parserWrap);
rest.use(express.urlencoded());
rest.use(express.json());
+1 -1
View File
@@ -144,7 +144,7 @@ var args = [
defaultValue: null
, required: false
, example: "/path/to/appium.log"
, help: 'Log output to this file instead of stdout'
, help: 'Also send log output to this file'
}],
[['--log-timestamp'], {