a661e439a0
Add the current frontend codebase with a baseline .gitignore and update piano-specific UI terms to teaching-oriented terms for the current product context. Made-with: Cursor
26 lines
588 B
JavaScript
26 lines
588 B
JavaScript
const log = require('./log.js')
|
|
|
|
function shortTail(s, tailLen) {
|
|
tailLen = tailLen || 8
|
|
if (!s) return ''
|
|
var t = String(s)
|
|
return t.length <= tailLen ? t : '…' + t.slice(-tailLen)
|
|
}
|
|
|
|
function logWeapp(phase, payload) {
|
|
try {
|
|
var line = typeof payload === 'string' ? payload : JSON.stringify(payload)
|
|
if (line.length > 1500) {
|
|
line = line.slice(0, 1500) + '…(truncated)'
|
|
}
|
|
log.info('[HtyWeapp]', phase, line)
|
|
} catch (err) {
|
|
log.info('[HtyWeapp]', phase, String(payload))
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
shortTail: shortTail,
|
|
logWeapp: logWeapp
|
|
}
|