parent
cca831a86b
commit
9fbf59eae4
@ -1,4 +1,4 @@ |
||||
const logger = require('./src/util/ts/log/log'); |
||||
const logger = require('./src/util/log/log'); |
||||
const client = {test: 'e', config: {logLevel: 1}}; |
||||
const log = logger(client); |
||||
log(); |
@ -1,8 +1,8 @@ |
||||
import config = require('../../../json/config.json'); |
||||
import levels = require('./levels.json'); |
||||
const config = require('../../json/config.json'); |
||||
const levels = require('../ts/log/levels.json'); |
||||
const validStrings = Object.keys(levels); |
||||
|
||||
const getLevel = (level: string | number): number => { |
||||
const getLevel = (level) => { |
||||
if (typeof level === 'number') { |
||||
if (level <= 0) {return 0;} |
||||
if (level > 3) {return 3;} |
@ -0,0 +1,3 @@ |
||||
export const log = (client) => (log = "Test Log", options = {}) => { |
||||
|
||||
}; |
@ -1,25 +0,0 @@ |
||||
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; |
@ -1 +0,0 @@ |
||||
export {}; |
@ -1,20 +0,0 @@ |
||||
"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; |
||||
} |
||||
}; |
@ -1,5 +0,0 @@ |
||||
{ |
||||
"TOP": 0, |
||||
"STANDARD": 1, |
||||
"VERBOSE": 2 |
||||
} |
@ -1,17 +0,0 @@ |
||||
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; |
@ -1,8 +0,0 @@ |
||||
"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