4 lines, improve logging slightly (#1153)

* use gun.log.once for logging consistency

* -
This commit is contained in:
Jeff Hykin 2021-10-30 01:09:37 -05:00 committed by GitHub
parent 49973ac522
commit 17af355ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

4
axe.js
View File

@ -42,8 +42,8 @@
tmp = peers[id = 'http://localhost:8765/gun'] = peers[id] || {};
tmp.id = tmp.url = id;
tmp.retry = tmp.retry || 0; // BUG: Check 0?
console.log("AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) hard coded peers.");
console.log("Warning: AXE alpha became super slow & laggy, now in testing only mode!");
Gun.log.once("AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) hard coded peers.");
Gun.log.once("Warning: AXE alpha became super slow & laggy, now in testing only mode!");
var last = JSON.parse((localStorage||'')[(opt.file||'')+'axe/']||null) || {};
Object.keys(last.peers||'').forEach(function(key){
tmp = peers[id = key] = peers[id] || {};

2
gun.js
View File

@ -1766,7 +1766,7 @@
;(function(){
var u;
if(''+u == typeof Gun){ return }
var DEP = function(n){ console.log("Warning! Deprecated internal utility will break in next version:", n) }
var DEP = function(n){ console.warn("Warning! Deprecated internal utility will break in next version:", n) }
// Generic javascript utilities.
var Type = Gun;
//Type.fns = Type.fn = {is: function(fn){ return (!!fn && fn instanceof Function) }}

View File

@ -10,7 +10,7 @@ function start(root){
var opt = root.opt, peers = opt.peers;
if(false === opt.axe){ return }
if((typeof process !== "undefined") && 'false' === ''+(process.env||'').AXE){ return }
console.log("AXE relay enabled!");
Gun.log.once("AXE relay enabled!");
var axe = root.axe = {}, tmp, id;
var mesh = opt.mesh = opt.mesh || Gun.Mesh(root); // DAM!
var dup = root.dup;

View File

@ -36,7 +36,7 @@ Gun.on('create', function(root){
socket.send(buf, 0, buf.length, udp.port, udp.address, noop);
}
console.log('Multicast on', udp.peer.id);
Gun.log.once('Multicast on', udp.peer.id);
return; // below code only needed for when WebSocket connections desired!
setInterval(function broadcast(){
port = port || (opt.web && opt.web.address()||{}).port;