adbkit-logcat
Advanced tools
Comparing version 1.0.3 to 1.1.0
(function() { | ||
var EventEmitter, Parser, _ref, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
var EventEmitter, Parser, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
EventEmitter = require('events').EventEmitter; | ||
Parser = (function(_super) { | ||
__extends(Parser, _super); | ||
Parser = (function(superClass) { | ||
extend(Parser, superClass); | ||
function Parser() { | ||
_ref = Parser.__super__.constructor.apply(this, arguments); | ||
return _ref; | ||
return Parser.__super__.constructor.apply(this, arguments); | ||
} | ||
@@ -15,0 +14,0 @@ |
(function() { | ||
var Binary, Entry, Parser, Priority, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -12,9 +12,11 @@ Parser = require('../parser'); | ||
Binary = (function(_super) { | ||
var HEADER_LENGTH; | ||
Binary = (function(superClass) { | ||
var HEADER_SIZE_MAX, HEADER_SIZE_V1; | ||
__extends(Binary, _super); | ||
extend(Binary, superClass); | ||
HEADER_LENGTH = 20; | ||
HEADER_SIZE_V1 = 20; | ||
HEADER_SIZE_MAX = 100; | ||
function Binary() { | ||
@@ -25,12 +27,17 @@ this.buffer = new Buffer(''); | ||
Binary.prototype.parse = function(chunk) { | ||
var cursor, data, entry, length, nsec, sec; | ||
var cursor, data, entry, headerSize, length, nsec, sec; | ||
this.buffer = Buffer.concat([this.buffer, chunk]); | ||
while (this.buffer.length > HEADER_LENGTH) { | ||
while (this.buffer.length > 4) { | ||
cursor = 0; | ||
length = this.buffer.readUInt16LE(cursor); | ||
if (this.buffer.length < HEADER_LENGTH + length) { | ||
cursor += 2; | ||
headerSize = this.buffer.readUInt16LE(cursor); | ||
if (headerSize < HEADER_SIZE_V1 || headerSize > HEADER_SIZE_MAX) { | ||
headerSize = HEADER_SIZE_V1; | ||
} | ||
cursor += 2; | ||
if (this.buffer.length < headerSize + length) { | ||
break; | ||
} | ||
entry = new Entry; | ||
cursor += 4; | ||
entry.setPid(this.buffer.readInt32LE(cursor)); | ||
@@ -45,2 +52,3 @@ cursor += 4; | ||
cursor += 4; | ||
cursor = headerSize; | ||
data = this.buffer.slice(cursor, cursor + length); | ||
@@ -47,0 +55,0 @@ cursor += length; |
(function() { | ||
var EventEmitter, Parser, Priority, Reader, Transform, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -14,4 +14,4 @@ EventEmitter = require('events').EventEmitter; | ||
Reader = (function(_super) { | ||
__extends(Reader, _super); | ||
Reader = (function(superClass) { | ||
extend(Reader, superClass); | ||
@@ -21,5 +21,5 @@ Reader.ANY = '*'; | ||
function Reader(options) { | ||
var _base; | ||
var base; | ||
this.options = options != null ? options : {}; | ||
(_base = this.options).format || (_base.format = 'binary'); | ||
(base = this.options).format || (base.format = 'binary'); | ||
if (this.options.fixLineFeeds == null) { | ||
@@ -75,31 +75,44 @@ this.options.fixLineFeeds = true; | ||
Reader.prototype._hook = function() { | ||
var transform, | ||
_this = this; | ||
var transform; | ||
if (this.options.fixLineFeeds) { | ||
transform = this.stream.pipe(new Transform); | ||
transform.on('data', function(data) { | ||
return _this.parser.parse(data); | ||
}); | ||
transform.on('data', (function(_this) { | ||
return function(data) { | ||
return _this.parser.parse(data); | ||
}; | ||
})(this)); | ||
} else { | ||
this.stream.on('data', function(data) { | ||
return _this.parser.parse(data); | ||
}); | ||
this.stream.on('data', (function(_this) { | ||
return function(data) { | ||
return _this.parser.parse(data); | ||
}; | ||
})(this)); | ||
} | ||
this.stream.on('error', function(err) { | ||
return _this.emit('error', err); | ||
}); | ||
this.stream.on('end', function() { | ||
return _this.emit('end'); | ||
}); | ||
this.stream.on('finish', function() { | ||
return _this.emit('finish'); | ||
}); | ||
this.parser.on('entry', function(entry) { | ||
if (_this._filter(entry)) { | ||
return _this.emit('entry', entry); | ||
} | ||
}); | ||
this.parser.on('error', function(err) { | ||
return _this.emit('error', err); | ||
}); | ||
this.stream.on('error', (function(_this) { | ||
return function(err) { | ||
return _this.emit('error', err); | ||
}; | ||
})(this)); | ||
this.stream.on('end', (function(_this) { | ||
return function() { | ||
return _this.emit('end'); | ||
}; | ||
})(this)); | ||
this.stream.on('finish', (function(_this) { | ||
return function() { | ||
return _this.emit('finish'); | ||
}; | ||
})(this)); | ||
this.parser.on('entry', (function(_this) { | ||
return function(entry) { | ||
if (_this._filter(entry)) { | ||
return _this.emit('entry', entry); | ||
} | ||
}; | ||
})(this)); | ||
this.parser.on('error', (function(_this) { | ||
return function(err) { | ||
return _this.emit('error', err); | ||
}; | ||
})(this)); | ||
}; | ||
@@ -106,0 +119,0 @@ |
(function() { | ||
var Stream, Transform, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Stream = require('stream'); | ||
Transform = (function(_super) { | ||
__extends(Transform, _super); | ||
Transform = (function(superClass) { | ||
extend(Transform, superClass); | ||
@@ -11,0 +11,0 @@ function Transform(options) { |
{ | ||
"name": "adbkit-logcat", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "A Node.js interface for working with Android's logcat output.", | ||
@@ -11,9 +11,9 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/CyberAgent/adbkit-logcat/issues" | ||
"url": "https://github.com/openstf/adbkit-logcat/issues" | ||
}, | ||
"license": "Apache-2.0", | ||
"author": { | ||
"name": "CyberAgent, Inc.", | ||
"email": "npm@cyberagent.co.jp", | ||
"url": "http://www.cyberagent.co.jp/" | ||
"name": "The OpenSTF Project", | ||
"email": "contact@openstf.io", | ||
"url": "https://openstf.io" | ||
}, | ||
@@ -23,3 +23,3 @@ "main": "./index", | ||
"type": "git", | ||
"url": "https://github.com/CyberAgent/adbkit-logcat.git" | ||
"url": "https://github.com/openstf/adbkit-logcat.git" | ||
}, | ||
@@ -31,19 +31,18 @@ "scripts": { | ||
}, | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"coffee-script": "~1.6.3", | ||
"grunt": "~0.4.1", | ||
"grunt-cli": "~0.1.11", | ||
"grunt-coffeelint": "~0.0.7", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-coffee": "~0.7.0", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt-exec": "~0.4.2", | ||
"grunt-jsonlint": "~1.0.2", | ||
"grunt-notify": "~0.2.16", | ||
"mocha": "~1.14.0", | ||
"sinon": "~1.7.3", | ||
"sinon-chai": "~2.4.0" | ||
"chai": "^3.5.0", | ||
"coffee-script": "^1.10.0", | ||
"grunt": "^1.0.1", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-coffeelint": "0.0.16", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-coffee": "^1.0.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-exec": "^1.0.0", | ||
"grunt-jsonlint": "^1.1.0", | ||
"grunt-notify": "^0.4.5", | ||
"mocha": "^3.0.2", | ||
"sinon": "^1.17.5", | ||
"sinon-chai": "^2.8.0" | ||
}, | ||
@@ -50,0 +49,0 @@ "engines": { |
@@ -218,6 +218,5 @@ # adbkit-logcat | ||
* Liblog | ||
- [logprint.c][logprint-source] | ||
* Logcat | ||
- [logcat.cpp][logcat-source] | ||
* [logprint.c](https://github.com/android/platform_system_core/blob/master/liblog/logprint.c) | ||
* [logcat.cpp](https://github.com/android/platform_system_core/blob/master/logcat/logcat.cpp) | ||
* [logger.h](https://github.com/android/platform_system_core/blob/master/include/log/logger.h) | ||
@@ -232,3 +231,3 @@ ## Contributing | ||
Copyright © CyberAgent, Inc. All Rights Reserved. | ||
Copyright © The OpenSTF Project. All Rights Reserved. | ||
@@ -238,6 +237,4 @@ [nodejs]: <http://nodejs.org/> | ||
[logcat-site]: <http://developer.android.com/tools/help/logcat.html> | ||
[logprint-source]: <https://github.com/android/platform_system_core/blob/master/liblog/logprint.c> | ||
[logcat-source]: <https://github.com/android/platform_system_core/blob/master/logcat/logcat.cpp> | ||
[node-stream]: <http://nodejs.org/api/stream.html> | ||
[node-events]: <http://nodejs.org/api/events.html> | ||
[node-buffer]: <http://nodejs.org/api/buffer.html> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22547
424
238