well that was a miserable idea

v2
Kit Kasune 2 years ago
parent cca831a86b
commit 9fbf59eae4
  1. 2
      bot.js
  2. 6
      src/util/log/getlevel.js
  3. 0
      src/util/log/levels.json
  4. 3
      src/util/log/log.js
  5. 0
      src/util/log/types.js
  6. 25
      src/util/ts/log/log.ts
  7. 0
      src/util/ts/log/types.ts
  8. 1
      src/util/util/ts/log/getlevel.d.ts
  9. 20
      src/util/util/ts/log/getlevel.js
  10. 5
      src/util/util/ts/log/levels.json
  11. 17
      src/util/util/ts/log/log.d.ts
  12. 8
      src/util/util/ts/log/log.js
  13. 0
      src/util/util/ts/log/types.d.ts

@ -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…
Cancel
Save