mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
Merge pull request #390 from rom1504/use_debug_package
use debug package, fix #386
This commit is contained in:
commit
d0fbcc71f2
@ -131,10 +131,10 @@ See [doc](doc/README.md)
|
|||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
You can enable some protocol debugging output using `NODE_DEBUG` environment variable:
|
You can enable some protocol debugging output using `DEBUG` environment variable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
NODE_DEBUG="minecraft-protocol" node [...]
|
DEBUG="minecraft-protocol" node [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer-equal": "^1.0.0",
|
"buffer-equal": "^1.0.0",
|
||||||
|
"debug": "^2.2.0",
|
||||||
"endian-toggle": "^0.0.0",
|
"endian-toggle": "^0.0.0",
|
||||||
"lodash.get": "^4.1.2",
|
"lodash.get": "^4.1.2",
|
||||||
"lodash.merge": "^4.3.0",
|
"lodash.merge": "^4.3.0",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const EventEmitter = require('events').EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
const debug = require('./debug');
|
const debug = require('debug')('minecraft-protocol');
|
||||||
const compression = require('./transforms/compression');
|
const compression = require('./transforms/compression');
|
||||||
const framing = require('./transforms/framing');
|
const framing = require('./transforms/framing');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const ping = require('../ping');
|
const ping = require('../ping');
|
||||||
const debug = require('../debug');
|
const debug = require('debug')('minecraft-protocol');
|
||||||
const states = require('../states');
|
const states = require('../states');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const minecraft_data = require('minecraft-data');
|
const minecraft_data = require('minecraft-data');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const yggserver = require('yggdrasil').server({});
|
const yggserver = require('yggdrasil').server({});
|
||||||
const ursa=require("../ursa");
|
const ursa=require("../ursa");
|
||||||
const debug = require("../debug");
|
const debug = require('debug')('minecraft-protocol');
|
||||||
|
|
||||||
module.exports = function(client, options) {
|
module.exports = function(client, options) {
|
||||||
client.once('encryption_begin', onEncryptionKeyRequest);
|
client.once('encryption_begin', onEncryptionKeyRequest);
|
||||||
|
18
src/debug.js
18
src/debug.js
@ -1,18 +0,0 @@
|
|||||||
const util = require('util');
|
|
||||||
|
|
||||||
let debug;
|
|
||||||
if(process.env.NODE_DEBUG && /(minecraft-protocol|mc-proto)/.test(process.env.NODE_DEBUG)) {
|
|
||||||
const pid = process.pid;
|
|
||||||
debug = function(x) {
|
|
||||||
// if console is not set up yet, then skip this.
|
|
||||||
if(!console.error)
|
|
||||||
return;
|
|
||||||
console.error('MC-PROTO: %d', pid,
|
|
||||||
util.format.apply(util, arguments).slice(0, 500));
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
debug = function() {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = debug;
|
|
Loading…
x
Reference in New Issue
Block a user