parent
d7efeb7b16
commit
cca831a86b
@ -1,4 +1,4 @@ |
||||
const logger = require('./src/util/log/log'); |
||||
const logger = require('./src/util/ts/log/log'); |
||||
const client = {test: 'e', config: {logLevel: 1}}; |
||||
const log = logger(client); |
||||
log(); |
@ -0,0 +1,16 @@ |
||||
{ |
||||
"log": { |
||||
"suffix": ">>", |
||||
"defaultLevel": 1, |
||||
"colors": { |
||||
"error": "", |
||||
"warn": "", |
||||
"success": "", |
||||
"notice": "", |
||||
"primary": "", |
||||
"secondary": "", |
||||
"altprimary": "", |
||||
"altsecondary": "" |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,16 @@ |
||||
{ |
||||
"log": { |
||||
"suffix": ">>", |
||||
"defaultLevel": 1, |
||||
"colors": { |
||||
"error": "", |
||||
"warn": "", |
||||
"success": "", |
||||
"notice": "", |
||||
"primary": "", |
||||
"secondary": "", |
||||
"altprimary": "", |
||||
"altsecondary": "" |
||||
} |
||||
} |
||||
} |
@ -1,5 +0,0 @@ |
||||
const getLevel = require('./getlevel'); |
||||
|
||||
module.exports = client => (message, level, source, color) => { |
||||
|
||||
}; |
@ -0,0 +1,25 @@ |
||||
import {Client} from "discord.js"; |
||||
|
||||
function color() {}; |
||||
|
||||
export const log = (client: Client) => (log: any | LogOptionsObject = "Test Log", options?: LogOptionsObject) => { |
||||
|
||||
}; |
||||
|
||||
export interface LogOptionsObject { |
||||
message?: any, |
||||
level?: string | number, |
||||
source?: string | { |
||||
text?: string, |
||||
color?: Color |
||||
}, |
||||
color?: Color, |
||||
suffix?: string |
||||
} |
||||
|
||||
export interface ColorObject { |
||||
type: "hex" | "default", |
||||
color: string |
||||
} |
||||
|
||||
export type Color = string | ColorObject; |
@ -0,0 +1 @@ |
||||
export {}; |
@ -0,0 +1,20 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
const config = require("../../../json/config.json"); |
||||
const levels = require("./levels.json"); |
||||
const validStrings = Object.keys(levels); |
||||
const getLevel = (level) => { |
||||
if (typeof level === 'number') { |
||||
if (level <= 0) { |
||||
return 0; |
||||
} |
||||
if (level > 3) { |
||||
return 3; |
||||
} |
||||
return Math.floor(level); |
||||
} |
||||
else { |
||||
const levelM = `${level}`.trim().toUpperCase(); |
||||
return validStrings.includes(levelM) ? levels[levelM] : typeof config.log.defaultLevel === 'number' ? getLevel(config.log.defaultLevel) : 1; |
||||
} |
||||
}; |
@ -0,0 +1,5 @@ |
||||
{ |
||||
"TOP": 0, |
||||
"STANDARD": 1, |
||||
"VERBOSE": 2 |
||||
} |
@ -0,0 +1,17 @@ |
||||
import { Client } from "discord.js"; |
||||
export declare const log: (client: Client) => (log?: any | LogOptionsObject, options?: LogOptionsObject) => void; |
||||
export interface LogOptionsObject { |
||||
message?: any; |
||||
level?: string | number; |
||||
source?: string | { |
||||
text?: string; |
||||
color?: Color; |
||||
}; |
||||
color?: Color; |
||||
suffix?: string; |
||||
} |
||||
export interface ColorObject { |
||||
type: "hex" | "default"; |
||||
color: string; |
||||
} |
||||
export declare type Color = string | ColorObject; |
@ -0,0 +1,8 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.log = void 0; |
||||
function color() { } |
||||
; |
||||
const log = (client) => (log = "Test Log", options) => { |
||||
}; |
||||
exports.log = log; |
Loading…
Reference in new issue