@simplism/core
Advanced tools
Comparing version 10.3.21 to 10.3.22
@@ -5,2 +5,4 @@ import { DateTime } from "../type/DateTime"; | ||
private readonly _prefix?; | ||
private static readonly _palletColors; | ||
private static readonly _groupColorMap; | ||
static history: ILoggerHistory[]; | ||
@@ -28,2 +30,3 @@ private static readonly _groupMap; | ||
historySize: number; | ||
color: ILogColor; | ||
} | ||
@@ -39,2 +42,9 @@ export interface ILoggerHistory { | ||
} | ||
export interface ILogColor { | ||
grey: string; | ||
log: string; | ||
info: string; | ||
warn: string; | ||
error: string; | ||
} | ||
export declare type LoggerSeverityString = "log" | "info" | "warn" | "error"; |
{ | ||
"name": "@simplism/core", | ||
"version": "10.3.21", | ||
"version": "10.3.22", | ||
"description": "Simplism Core Package", | ||
@@ -5,0 +5,0 @@ "repository": "github:kslhunter/simplism", |
@@ -74,4 +74,3 @@ import {Type} from "../type/Type"; | ||
keyObj = keySelectorOrKeys(this[i], i); | ||
} | ||
else { | ||
} else { | ||
keyObj = {}; | ||
@@ -86,4 +85,3 @@ for (const key of keySelectorOrKeys) { | ||
valueObj = valueSelectorOrValueKeys(this[i], i); | ||
} | ||
else if (valueSelectorOrValueKeys instanceof Array) { | ||
} else if (valueSelectorOrValueKeys instanceof Array) { | ||
valueObj = {}; | ||
@@ -93,4 +91,3 @@ for (const valueKey of valueSelectorOrValueKeys) { | ||
} | ||
} | ||
else { | ||
} else { | ||
valueObj = this[i]; | ||
@@ -103,4 +100,3 @@ } | ||
existsRecord.values.push(valueObj); | ||
} | ||
else { | ||
} else { | ||
result.push({key: keyObj, values: [valueObj]}); | ||
@@ -148,4 +144,3 @@ } | ||
return filtered[0]; | ||
} | ||
else { | ||
} else { | ||
const key = args[0]; | ||
@@ -164,4 +159,3 @@ const checkValue = args[1]; | ||
} | ||
} | ||
else { | ||
} else { | ||
return this[this.length - 1]; | ||
@@ -177,4 +171,3 @@ } | ||
result += item; | ||
} | ||
else { | ||
} else { | ||
result = item; | ||
@@ -275,4 +268,3 @@ } | ||
return options.keyProps.every(keyProp => targetItem[keyProp] === item[keyProp]); | ||
} | ||
else { | ||
} else { | ||
return Object.equal(targetItem, item); | ||
@@ -285,4 +277,3 @@ } | ||
result.push({source: item}); | ||
} | ||
else { | ||
} else { | ||
// 수정됨 | ||
@@ -320,4 +311,3 @@ if (options && options.keyProps && !Object.equal(item, existsTargetItem)) { | ||
} | ||
} | ||
else { | ||
} else { | ||
for (const targetItem of target) { | ||
@@ -333,4 +323,3 @@ const item = this.single(sourceItem => options.keyProps!.every(keyProp => sourceItem[keyProp] === targetItem[keyProp])); | ||
Object.assign(item, targetItem); | ||
} | ||
else { | ||
} else { | ||
this.push(targetItem); | ||
@@ -337,0 +326,0 @@ } |
import {DateTime} from "../type/DateTime"; | ||
export class Logger { | ||
private static readonly _palletColors = !process.versions.node ? [ | ||
"color: #827717;", | ||
"color: #388E3C;", | ||
"color: #1976D2;", | ||
"color: #AB47BC;", | ||
"color: #00838F;", | ||
"color: #F44336;" | ||
] : [ | ||
"\x1b[33m", | ||
"\x1b[32m", | ||
"\x1b[34m", | ||
"\x1b[35m", | ||
"\x1b[36m", | ||
"\x1b[31m" | ||
]; | ||
private static readonly _groupColorMap = new Map<string, string>(); | ||
public static history: ILoggerHistory[] = []; | ||
@@ -12,3 +29,18 @@ private static readonly _groupMap = new Map<string, ILoggerConfig>(); | ||
outputPath: undefined, | ||
historySize: 30 | ||
historySize: 30, | ||
color: !process.versions.node | ||
? { | ||
grey: "color: grey;", | ||
log: "color: black;", | ||
info: "color: #2196F3;", | ||
warn: "color: #FF9800;", | ||
error: "color: #F44336;" | ||
} | ||
: { | ||
grey: "\x1b[90m", | ||
log: "\x1b[0m", | ||
info: "\x1b[36m", | ||
warn: "\x1b[33m", | ||
error: "\x1b[31m" | ||
} | ||
}; | ||
@@ -36,3 +68,18 @@ | ||
outputPath: undefined, | ||
historySize: 30 | ||
historySize: 30, | ||
color: !process.versions.node | ||
? { | ||
grey: "color: grey;", | ||
log: "color: black;", | ||
info: "color: #2196F3;", | ||
warn: "color: #FF9800;", | ||
error: "color: #F44336;" | ||
} | ||
: { | ||
grey: "\x1b[90m", | ||
log: "\x1b[0m", | ||
info: "\x1b[36m", | ||
warn: "\x1b[33m", | ||
error: "\x1b[31m" | ||
} | ||
}; | ||
@@ -85,2 +132,6 @@ } | ||
private _write(severity: LoggerSeverityString, logs: any[]): void { | ||
if (!Logger._groupColorMap.has(this._groupName)) { | ||
Logger._groupColorMap.set(this._groupName, Logger._palletColors[Logger._groupColorMap.size % Logger._palletColors.length]); | ||
} | ||
const now = new DateTime(); | ||
@@ -124,3 +175,3 @@ const at = process.version ? new Error().stack!.match(/at .*/g)![2].trim() : undefined; | ||
if (this.config.consoleLogSeverities.includes(severity)) { | ||
let text = `${log.now} - [${log.severity}] - from ${log.group}`; | ||
/*let text = `${log.now} - [${log.severity}] - from ${log.group}`; | ||
if (process.env.NODE_ENV !== "production") { | ||
@@ -131,3 +182,10 @@ text += log.at ? " - " + log.at : ""; | ||
console.log(text); | ||
console.log(text);*/ | ||
const text = `${Logger._groupColorMap.get(this._groupName)}${log.group}:\t${this.config.color[severity]}${log.severity.padEnd(5, " ")}\t${this.config.color.log} ${log.prefix ? log.prefix + " " : ""}${convertedLogs.join("\r\n")}`; | ||
// 콘솔 출력 | ||
if (this.config.consoleLogSeverities.includes(severity)) { | ||
console.log(text); | ||
} | ||
} | ||
@@ -164,2 +222,3 @@ | ||
historySize: number; | ||
color: ILogColor; | ||
} | ||
@@ -177,2 +236,10 @@ | ||
export interface ILogColor { | ||
grey: string; | ||
log: string; | ||
info: string; | ||
warn: string; | ||
error: string; | ||
} | ||
export type LoggerSeverityString = "log" | "info" | "warn" | "error"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
233280
3311