cleanup console.logs and moved to proper log level console to make finding stray console.logs easier

This commit is contained in:
Henry Jameson 2025-01-28 16:28:23 +02:00
parent e690ce193b
commit 7f9fe6b660
16 changed files with 50 additions and 59 deletions

View file

@ -9,7 +9,7 @@ var ora = require('ora')
var webpack = require('webpack') var webpack = require('webpack')
var webpackConfig = require('./webpack.prod.conf') var webpackConfig = require('./webpack.prod.conf')
console.log( console.info(
' Tip:\n' + ' Tip:\n' +
' Built files are meant to be served over an HTTP server.\n' + ' Built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n' ' Opening index.html over file:// won\'t work.\n'

View file

@ -27,14 +27,12 @@ module.exports = function () {
} }
if (warnings.length) { if (warnings.length) {
console.log('') console.warn(chalk.yellow('\nTo use this template, you must update following to modules:\n'))
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (var i = 0; i < warnings.length; i++) { for (var i = 0; i < warnings.length; i++) {
var warning = warnings[i] var warning = warnings[i]
console.log(' ' + warning) console.warn(' ' + warning)
} }
console.log() console.warn()
process.exit(1) process.exit(1)
} }
} }

View file

@ -72,10 +72,10 @@ app.use(staticPath, express.static('./static'))
module.exports = app.listen(port, function (err) { module.exports = app.listen(port, function (err) {
if (err) { if (err) {
console.log(err) console.error(err)
return return
} }
var uri = 'http://localhost:' + port var uri = 'http://localhost:' + port
console.log('Listening at ' + uri + '\n') console.info('Listening at ' + uri + '\n')
// opn(uri) // opn(uri)
}) })

View file

@ -8,10 +8,10 @@ try {
// and that's how actual BE reports its url // and that's how actual BE reports its url
settings.target = settings.target.replace(/\/$/, '') settings.target = settings.target.replace(/\/$/, '')
} }
console.log('Using local dev server settings (/config/local.json):') console.info('Using local dev server settings (/config/local.json):')
console.log(JSON.stringify(settings, null, 2)) console.info(JSON.stringify(settings, null, 2))
} catch (e) { } catch (e) {
console.log('Local dev server settings not found (/config/local.json)') console.info('Local dev server settings not found (/config/local.json)')
} }
const target = settings.target || 'http://localhost:4000/' const target = settings.target || 'http://localhost:4000/'

View file

@ -61,9 +61,7 @@ export default {
}, },
methods: { methods: {
optionallyPrompt () { optionallyPrompt () {
console.log('Triggered')
if (this.shouldConfirm) { if (this.shouldConfirm) {
console.log('SHAWN!!')
this.show() this.show()
} else { } else {
this.doMute() this.doMute()

View file

@ -162,7 +162,6 @@ const EmojiPicker = {
} else { } else {
emojiSizeReal = emojiSizeValue emojiSizeReal = emojiSizeValue
} }
console.log(emojiSizeReal)
const fullEmojiSize = emojiSizeReal + (2 * 0.2 * fontSizeMultiplier * 14) const fullEmojiSize = emojiSizeReal + (2 * 0.2 * fontSizeMultiplier * 14)
this.emojiSize = fullEmojiSize this.emojiSize = fullEmojiSize
@ -319,7 +318,6 @@ const EmojiPicker = {
return this.emojiSize return this.emojiSize
}, },
itemPerRow () { itemPerRow () {
console.log('CALC', this.emojiSize, this.width)
return this.width ? Math.floor(this.width / this.emojiSize) : 6 return this.width ? Math.floor(this.width / this.emojiSize) : 6
}, },
activeGroupView () { activeGroupView () {

View file

@ -24,6 +24,6 @@ export const getBookmarkFolderEntries = state => state.bookmarkFolders.allFolder
routeObject: { name: 'bookmark-folder', params: { id: folder.id } }, routeObject: { name: 'bookmark-folder', params: { id: folder.id } },
labelRaw: folder.name, labelRaw: folder.name,
iconEmoji: folder.emoji, iconEmoji: folder.emoji,
iconEmojiUrl: console.log(folder) || folder.emoji_url, iconEmojiUrl: folder.emoji_url,
iconLetter: folder.name[0] iconLetter: folder.name[0]
})) }))

View file

@ -130,7 +130,7 @@ export default {
const serialized = this.cValue.map(x => serializeShadow(x)).join(',') const serialized = this.cValue.map(x => serializeShadow(x)).join(',')
serialized.split(/,/).map(deserializeShadow) // validate serialized.split(/,/).map(deserializeShadow) // validate
const expandedShadow = flattenDeep(findShadow(this.cValue, { dynamicVars: {}, staticVars: this.staticVars })) const expandedShadow = flattenDeep(findShadow(this.cValue, { dynamicVars: {}, staticVars: this.staticVars }))
const fixedShadows = expandedShadow.map(x => ({ ...x, color: console.log(x) || rgb2hex(x.color) })) const fixedShadows = expandedShadow.map(x => ({ ...x, color: rgb2hex(x.color) }))
if (this.separateInset) { if (this.separateInset) {
result = { result = {

View file

@ -280,7 +280,6 @@ const Status = {
case 'nsfw': return this.$t('status.sensitive_muted') case 'nsfw': return this.$t('status.sensitive_muted')
} }
} }
console.log(this.status)
if (this.muteReasons.length > 1) { if (this.muteReasons.length > 1) {
return this.$t( return this.$t(
'status.multi_reason_mute', 'status.multi_reason_mute',
@ -306,7 +305,7 @@ const Status = {
const relationshipReblog = reblog && this.$store.getters.relationship(reblog.user.id) const relationshipReblog = reblog && this.$store.getters.relationship(reblog.user.id)
return (status.muted && !status.thread_muted) || return (status.muted && !status.thread_muted) ||
// Reprööt of a muted post according to BE // Reprööt of a muted post according to BE
(reblog && reblog.muted) || (reblog && reblog.muted && !reblog.thread_muted) ||
// Muted user // Muted user
relationship.muting || relationship.muting ||
// Muted user of a reprööt // Muted user of a reprööt

View file

@ -2,23 +2,23 @@
const arg = process.argv[2] const arg = process.argv[2]
if (typeof arg === 'undefined') { if (typeof arg === 'undefined') {
console.log('This is a very simple and tiny tool that checks en.json with any other language and') console.info('This is a very simple and tiny tool that checks en.json with any other language and')
console.log('outputs all the things present in english but missing in foreign language.') console.info('outputs all the things present in english but missing in foreign language.')
console.log('') console.info('')
console.log('Usage: ./compare.js <lang> ') console.info('Usage: ./compare.js <lang> ')
console.log(' or') console.info(' or')
console.log(' node ./compare.js <lang>') console.info(' node ./compare.js <lang>')
console.log('') console.info('')
console.log('Where <lang> is name of .json file containing language. For ./fi.json it should be:') console.info('Where <lang> is name of .json file containing language. For ./fi.json it should be:')
console.log(' ./compare.js fi ') console.info(' ./compare.js fi ')
console.log('') console.info('')
console.log('Limitations: ') console.info('Limitations: ')
console.log('* This program does not work with languages left over in messages.js') console.info('* This program does not work with languages left over in messages.js')
console.log('* This program does not check for extra strings present in foreign language but missing') console.info('* This program does not check for extra strings present in foreign language but missing')
console.log(' in english.js (for now)') console.info(' in english.js (for now)')
console.log('') console.info('')
console.log('There are no other arguments or options. Make an issue if you encounter a bug or want') console.info('There are no other arguments or options. Make an issue if you encounter a bug or want')
console.log('some feature to be implemented. Merge requests are welcome as well.') console.info('some feature to be implemented. Merge requests are welcome as well.')
process.exit() process.exit()
} }
@ -35,10 +35,10 @@ function walker (a, b, path = []) {
const article = aType[0] === 'o' ? 'an' : 'a' const article = aType[0] === 'o' ? 'an' : 'a'
if (bType === 'undefined') { if (bType === 'undefined') {
console.log(`Foreign language is missing ${article} ${aType} at path ${currentPath.join('.')}`) console.warn(`Foreign language is missing ${article} ${aType} at path ${currentPath.join('.')}`)
} else if (aType === 'object') { } else if (aType === 'object') {
if (bType !== 'object') { if (bType !== 'object') {
console.log(`Type mismatch! English has ${aType} while foreign has ${bType} at path ${currentPath.join['.']}`) console.warn(`Type mismatch! English has ${aType} while foreign has ${bType} at path ${currentPath.join['.']}`)
} else { } else {
walker(aVal, bVal, currentPath) walker(aVal, bVal, currentPath)
} }

View file

@ -131,7 +131,6 @@ export const _getRecentData = (cache, live, isTest) => {
prefsStorage: _merge(a.prefsStorage, b.prefsStorage), prefsStorage: _merge(a.prefsStorage, b.prefsStorage),
flagStorage: _merge(a.flagStorage, b.flagStorage) flagStorage: _merge(a.flagStorage, b.flagStorage)
}) })
console.log(result.recent)
result.recent = isTest ? result.recent : (result.recent && merge(defaultState, result.recent)) result.recent = isTest ? result.recent : (result.recent && merge(defaultState, result.recent))
result.stale = isTest ? result.stale : (result.stale && merge(defaultState, result.stale)) result.stale = isTest ? result.stale : (result.stale && merge(defaultState, result.stale))

View file

@ -276,8 +276,8 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
// NOOP, it is known status but we don't do anything about it for now // NOOP, it is known status but we don't do anything about it for now
}, },
default: (unknown) => { default: (unknown) => {
console.log('unknown status type') console.warn('unknown status type')
console.log(unknown) console.warn(unknown)
} }
} }

View file

@ -1,7 +1,7 @@
import { invertLightness, contrastRatio, convert } from 'chromatism' import { invertLightness, contrastRatio, convert } from 'chromatism'
// useful for visualizing color when debugging // useful for visualizing color when debugging
export const consoleColor = (color) => console.log('%c##########', 'background: ' + color + '; color: ' + color) // const consoleColor = (color) => console.debug('%c##########', 'background: ' + color + '; color: ' + color)
/** /**
* Convert r, g, b values into hex notation. All components are [0-255] * Convert r, g, b values into hex notation. All components are [0-255]

View file

@ -539,7 +539,6 @@ describe('RichContent', () => {
`, `,
props: ['handleLinks', 'attentions', 'vhtml'] props: ['handleLinks', 'attentions', 'vhtml']
} }
console.log(1)
const ptest = (handleLinks, vhtml) => { const ptest = (handleLinks, vhtml) => {
const t0 = performance.now() const t0 = performance.now()
@ -562,11 +561,11 @@ describe('RichContent', () => {
return `Mount: ${t1 - t0}ms, destroy: ${t2 - t1}ms, avg ${(t1 - t0) / amount}ms - ${(t2 - t1) / amount}ms per item` return `Mount: ${t1 - t0}ms, destroy: ${t2 - t1}ms, avg ${(t1 - t0) / amount}ms - ${(t2 - t1) / amount}ms per item`
} }
console.log(`${amount} items with links handling:`) console.debug(`${amount} items with links handling:`)
console.log(ptest(true)) console.debug(ptest(true))
console.log(`${amount} items without links handling:`) console.debug(`${amount} items without links handling:`)
console.log(ptest(false)) console.debug(ptest(false))
console.log(`${amount} items plain v-html:`) console.debug(`${amount} items plain v-html:`)
console.log(ptest(false, true)) console.debug(ptest(false, true))
}) })
}) })

View file

@ -21,17 +21,17 @@ describe('ISS (de)serialization', () => {
const onlyComponent = componentsContext('./components/panel_header.style.js').default const onlyComponent = componentsContext('./components/panel_header.style.js').default
it.only(`(De)serialization of component ${onlyComponent.name} works`, () => { it.only(`(De)serialization of component ${onlyComponent.name} works`, () => {
const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x })) const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x }))
console.log('BEGIN INPUT ================') console.debug('BEGIN INPUT ================')
console.log(normalized) console.debug(normalized)
console.log('END INPUT ==================') console.debug('END INPUT ==================')
const serialized = serialize(normalized) const serialized = serialize(normalized)
console.log('BEGIN SERIAL ===============') console.debug('BEGIN SERIAL ===============')
console.log(serialized) console.debug(serialized)
console.log('END SERIAL =================') console.debug('END SERIAL =================')
const deserialized = deserialize(serialized) const deserialized = deserialize(serialized)
console.log('BEGIN DESERIALIZED =========') console.debug('BEGIN DESERIALIZED =========')
console.log(serialized) console.debug(serialized)
console.log('END DESERIALIZED ===========') console.debug('END DESERIALIZED ===========')
// for some reason comparing objects directly fails the assert // for some reason comparing objects directly fails the assert
expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2)) expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2))

View file

@ -60,7 +60,7 @@ const run = () => {
}, {}) }, {})
fs.writeFile(outputFilename, JSON.stringify(sorted, null, 2), 'utf8', (err) => { fs.writeFile(outputFilename, JSON.stringify(sorted, null, 2), 'utf8', (err) => {
if (err) console.log('Error writing file', err) if (err) console.error('Error writing file', err)
}) })
} }