<commit_before>var catNames = require('cat-names')
var concat = require('concat-stream')
var dragDrop = require('drag-drop/buffer')
var hat = require('hat')
var once = require('once')
var stream = require('stream')
var through = require('through')
var Tracker = require('bittorrent-tracker/client')
var WebTorrent = require('webtorrent')

// var TRACKER_URL = 'wss://tracker.webtorrent.io'
var TRACKER_URL = 'ws://localhost:9000'

var username = catNames.random()

// pick random stroke color
var color = 'rgb(' + hat(8, 10) + ',' + hat(8, 10) + ',' + hat(8, 10) + ')'

var currentPathId = null
var state = {}
var peers = []
var peerId = new Buffer(hat(160), 'hex')

var torrentData = {}
var client = new WebTorrent({ peerId: peerId })

// create canvas
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d')
document.body.appendChild(canvas)

// set canvas settings and size
setupCanvas()
window.addEventListener('resize', setupCanvas)

function setupCanvas () {<commit_msg>log webtorrent errors<commit_after>var catNames = require('cat-names')
var concat = require('concat-stream')
var dragDrop = require('drag-drop/buffer')
var hat = require('hat')
var once = require('once')
var stream = require('stream')
var through = require('through')
var Tracker = require('bittorrent-tracker/client')
var WebTorrent = require('webtorrent')

// var TRACKER_URL = 'wss://tracker.webtorrent.io'
var TRACKER_URL = 'ws://localhost:9000'

var username = catNames.random()

// pick random stroke color
var color = 'rgb(' + hat(8, 10) + ',' + hat(8, 10) + ',' + hat(8, 10) + ')'

var currentPathId = null
var state = {}
var peers = []
var peerId = new Buffer(hat(160), 'hex')

var torrentData = {}
var client = new WebTorrent({ peerId: peerId })
client.on('error', function (err) {
  console.error(err.stack || err.message || err)
})
client.on('warning', function (err) {
  console.error(err.stack || err.message || err)
})

// create canvas
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d')
document.body.appendChild(canvas)

// set canvas settings and size
setupCanvas()
window.addEventListener('resize', setupCanvas)

function setupCanvas () {
{'fraction_non_alphanumeric': 0.1637694419030192, 'fraction_numerical': 0.01555352241537054, 'mean_word_length': 5.126050420168068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1302923', 'n_tokens_mistral': 722, 'n_tokens_neox': 701, 'n_words': 190}