chore: changed logger export

This commit is contained in:
Junseo Park 2021-02-25 13:43:41 +09:00
parent d1b618341e
commit 75c3a82c90
4 changed files with 23 additions and 22 deletions

View File

@ -1,4 +1,4 @@
import { Logger } from '@utils/Logger'
import Logger from '@utils/Logger'
import { useEffect } from 'react'
const Advertisement = ({ size='short' }:AdvertisementProps): JSX.Element => {
@ -6,7 +6,8 @@ const Advertisement = ({ size='short' }:AdvertisementProps): JSX.Element => {
if(process.env.NODE_ENV === 'production') {
window.adsbygoogle = window.adsbygoogle || []
window.adsbygoogle.push({})
} else Logger.debug('Ads Pushed')
}
Logger.debug('Ads Pushed')
}, [])
return <div className={`z-0 mx-auto w-full text-center text-white ${process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700'}`} style={size === 'short' ? { height: '90px' } : { height: '330px'}}>

View File

@ -1,7 +1,7 @@
import { SyntheticEvent, useEffect, useState } from 'react'
import { KoreanbotsEndPoints } from '@utils/Constants'
import { supportsWebP } from '@utils/Tools'
import { Logger } from '@utils/Logger'
import Logger from '@utils/Logger'
const DiscordAvatar = (props: {
alt?: string

View File

@ -3,7 +3,9 @@ import type { AppProps } from 'next/app'
import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { init } from '@utils/Sentry'
import Logger from '@utils/Logger'
const Footer = dynamic(() => import('@components/Footer'))
const Navbar = dynamic(() => import('@components/Navbar'))
@ -18,7 +20,6 @@ import '../app.css'
import '@fortawesome/fontawesome-free/css/all.css'
import '../github-markdown.css'
import { Theme } from '@types'
import { Logger } from '@utils/Logger'
init()

View File

@ -1,21 +1,20 @@
export class Logger {
private static genStyle(bg: string, text='black') {
return `color:${text};background:${bg};padding:1px 3px;border-radius:2px;margin-right:5px;`
const Logger = {
debug: function(message: string) {
print('DEBUG', message, genStyle('cyan'))
},
warn: function(message: string) {
print('WARN', message, genStyle('yellow'))
},
error: function(message: string) {
print('ERROR', message, genStyle('red', 'white'))
}
}
private static print(level: string, message: string, style: string) {
console.log(`%c${level}` + `%c${message}`, style, '')
}
function genStyle(bg: string, text='black') {
return `color:${text};background:${bg};padding:1px 3px;border-radius:2px;margin-right:5px;`
}
static debug(message: string) {
this.print('DEBUG', message, this.genStyle('cyan'))
}
static warn(message: string) {
this.print('WARN', message, this.genStyle('yellow'))
}
static error(message: string) {
this.print('ERROR', message, this.genStyle('red', 'white'))
}
}
function print(level: string, message: string, style: string) {
console.log(`%c${level}` + `%c${message}`, style, '')
}
export default Logger