Comparing version 0.9.7 to 0.9.8
@@ -1,13 +0,12 @@ | ||
import { SimpleCode, ISimpleCodeSeed, EnumSimpleCodeError } from './simplecode'; | ||
import { common_ret, ICommonRetData, ICommonMsgHead, XCommonRet } from './common_ret'; | ||
import { error_utils } from './common_error'; | ||
import { datetimeUtils } from './datetimeUtils'; | ||
import { codeUtils, IMD5Options } from './codeutils'; | ||
import { bitUtils, EnumBitConst } from './bitUtils'; | ||
import { utils } from './utils'; | ||
import { CNYCurrency } from './cnycurrency'; | ||
import { error_common, MemorySize, DatetimeConstant } from './constant'; | ||
import { watchRequire } from './watchrequire'; | ||
import { getLogger, ILog, logPrefix, setGetLogger } from './log'; | ||
import { EnumBufferSize, EnumBufferWapperError, BufferWapper } from './buffer_wapper'; | ||
export { utils, bitUtils, EnumBitConst, CNYCurrency, error_common, MemorySize, codeUtils, IMD5Options, datetimeUtils, DatetimeConstant, error_utils, common_ret, ICommonRetData, ICommonMsgHead, XCommonRet, watchRequire, SimpleCode, ISimpleCodeSeed, EnumSimpleCodeError, EnumBufferSize, EnumBufferWapperError, BufferWapper, getLogger, setGetLogger, ILog, logPrefix, }; | ||
export * from './simplecode'; | ||
export * from './common_ret'; | ||
export * from './common_error'; | ||
export * from './datetimeUtils'; | ||
export * from './codeutils'; | ||
export * from './bitUtils'; | ||
export * from './utils'; | ||
export * from './cnycurrency'; | ||
export * from './constant'; | ||
export * from './watchrequire'; | ||
export * from './log'; | ||
export * from './buffer_wapper'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.logPrefix = exports.setGetLogger = exports.getLogger = exports.BufferWapper = exports.EnumBufferWapperError = exports.EnumBufferSize = exports.EnumSimpleCodeError = exports.SimpleCode = exports.watchRequire = exports.XCommonRet = exports.common_ret = exports.error_utils = exports.DatetimeConstant = exports.datetimeUtils = exports.codeUtils = exports.MemorySize = exports.error_common = exports.CNYCurrency = exports.EnumBitConst = exports.bitUtils = exports.utils = void 0; | ||
const simplecode_1 = require("./simplecode"); | ||
Object.defineProperty(exports, "SimpleCode", { enumerable: true, get: function () { return simplecode_1.SimpleCode; } }); | ||
Object.defineProperty(exports, "EnumSimpleCodeError", { enumerable: true, get: function () { return simplecode_1.EnumSimpleCodeError; } }); | ||
const common_ret_1 = require("./common_ret"); | ||
Object.defineProperty(exports, "common_ret", { enumerable: true, get: function () { return common_ret_1.common_ret; } }); | ||
Object.defineProperty(exports, "XCommonRet", { enumerable: true, get: function () { return common_ret_1.XCommonRet; } }); | ||
const common_error_1 = require("./common_error"); | ||
Object.defineProperty(exports, "error_utils", { enumerable: true, get: function () { return common_error_1.error_utils; } }); | ||
const datetimeUtils_1 = require("./datetimeUtils"); | ||
Object.defineProperty(exports, "datetimeUtils", { enumerable: true, get: function () { return datetimeUtils_1.datetimeUtils; } }); | ||
const codeutils_1 = require("./codeutils"); | ||
Object.defineProperty(exports, "codeUtils", { enumerable: true, get: function () { return codeutils_1.codeUtils; } }); | ||
const bitUtils_1 = require("./bitUtils"); | ||
Object.defineProperty(exports, "bitUtils", { enumerable: true, get: function () { return bitUtils_1.bitUtils; } }); | ||
Object.defineProperty(exports, "EnumBitConst", { enumerable: true, get: function () { return bitUtils_1.EnumBitConst; } }); | ||
const utils_1 = require("./utils"); | ||
Object.defineProperty(exports, "utils", { enumerable: true, get: function () { return utils_1.utils; } }); | ||
const cnycurrency_1 = require("./cnycurrency"); | ||
Object.defineProperty(exports, "CNYCurrency", { enumerable: true, get: function () { return cnycurrency_1.CNYCurrency; } }); | ||
const constant_1 = require("./constant"); | ||
Object.defineProperty(exports, "error_common", { enumerable: true, get: function () { return constant_1.error_common; } }); | ||
Object.defineProperty(exports, "MemorySize", { enumerable: true, get: function () { return constant_1.MemorySize; } }); | ||
Object.defineProperty(exports, "DatetimeConstant", { enumerable: true, get: function () { return constant_1.DatetimeConstant; } }); | ||
const watchrequire_1 = require("./watchrequire"); | ||
Object.defineProperty(exports, "watchRequire", { enumerable: true, get: function () { return watchrequire_1.watchRequire; } }); | ||
const log_1 = require("./log"); | ||
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return log_1.getLogger; } }); | ||
Object.defineProperty(exports, "logPrefix", { enumerable: true, get: function () { return log_1.logPrefix; } }); | ||
Object.defineProperty(exports, "setGetLogger", { enumerable: true, get: function () { return log_1.setGetLogger; } }); | ||
const buffer_wapper_1 = require("./buffer_wapper"); | ||
Object.defineProperty(exports, "EnumBufferSize", { enumerable: true, get: function () { return buffer_wapper_1.EnumBufferSize; } }); | ||
Object.defineProperty(exports, "EnumBufferWapperError", { enumerable: true, get: function () { return buffer_wapper_1.EnumBufferWapperError; } }); | ||
Object.defineProperty(exports, "BufferWapper", { enumerable: true, get: function () { return buffer_wapper_1.BufferWapper; } }); | ||
__exportStar(require("./simplecode"), exports); | ||
__exportStar(require("./common_ret"), exports); | ||
__exportStar(require("./common_error"), exports); | ||
__exportStar(require("./datetimeUtils"), exports); | ||
__exportStar(require("./codeutils"), exports); | ||
__exportStar(require("./bitUtils"), exports); | ||
__exportStar(require("./utils"), exports); | ||
__exportStar(require("./cnycurrency"), exports); | ||
__exportStar(require("./constant"), exports); | ||
__exportStar(require("./watchrequire"), exports); | ||
__exportStar(require("./log"), exports); | ||
__exportStar(require("./buffer_wapper"), exports); |
@@ -44,4 +44,5 @@ /** | ||
*/ | ||
export declare class LogManager { | ||
declare class LogManager { | ||
private m_MapLogger; | ||
private m_createLog; | ||
constructor(); | ||
@@ -53,5 +54,17 @@ /** | ||
getLogger(paramTag: string): ILog; | ||
/** 设置缺省的log */ | ||
setDefaultLog(paramDefaultLog: ILog): void; | ||
/** 设置创建log */ | ||
setCreateLog(paramCreateLog: (paramTag: string) => ILog): void; | ||
} | ||
/** | ||
* @deprecated 不建议使用,可以直接使用logManager的setCreateLog方法,设置创建函数 | ||
*/ | ||
export declare type TGetLoggerFun = (paramTag: string) => ILog; | ||
/** | ||
* 取日志管理实例 | ||
* @returns | ||
*/ | ||
export declare function GetLogManager(): LogManager; | ||
/** | ||
* 取指定tag的local log | ||
@@ -67,2 +80,3 @@ * 如果没有这个tag的日志,则创建一个 | ||
* - 返回false表示paramGetLogger不是一个函数 | ||
* @deprecated 不建议使用,可以直接使用logManager的setCreateLog方法,设置创建函数 | ||
* @param {function} paramGetLogger 新的getLogger函数实现,替换getLogger | ||
@@ -73,1 +87,2 @@ * @return {boolean} 设置结果 | ||
export declare function getLogger(paramTag: string): ILog; | ||
export {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLogger = exports.setGetLogger = exports.getLocalLogger = exports.LogManager = exports.LogConsole = exports.logPrefix = void 0; | ||
exports.getLogger = exports.setGetLogger = exports.getLocalLogger = exports.GetLogManager = exports.LogConsole = exports.logPrefix = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
@@ -109,3 +109,3 @@ const util_1 = __importDefault(require("util")); | ||
exports.LogConsole = LogConsole; | ||
const log = new LogConsole('default'); | ||
let defaultLog = new LogConsole('default'); | ||
/** | ||
@@ -119,2 +119,3 @@ * 日志管理器 | ||
this.m_MapLogger = new Map(); | ||
this.m_createLog = (paramTag) => new LogConsole(paramTag); | ||
} | ||
@@ -129,3 +130,3 @@ /** | ||
if (utils_1.utils.isNull(l)) { | ||
l = new LogConsole(paramTag); | ||
l = this.m_createLog(paramTag); | ||
this.m_MapLogger.set(paramTag, l); | ||
@@ -136,7 +137,14 @@ } | ||
else { | ||
return log; | ||
return defaultLog; | ||
} | ||
} | ||
/** 设置缺省的log */ | ||
setDefaultLog(paramDefaultLog) { | ||
defaultLog = paramDefaultLog; | ||
} | ||
/** 设置创建log */ | ||
setCreateLog(paramCreateLog) { | ||
this.m_createLog = paramCreateLog; | ||
} | ||
} | ||
exports.LogManager = LogManager; | ||
/** | ||
@@ -147,2 +155,10 @@ * 日志管理器 | ||
/** | ||
* 取日志管理实例 | ||
* @returns | ||
*/ | ||
function GetLogManager() { | ||
return logManager; | ||
} | ||
exports.GetLogManager = GetLogManager; | ||
/** | ||
* 取指定tag的log | ||
@@ -171,2 +187,3 @@ * 如果没有这个tag的日志,则创建一个 | ||
* - 返回false表示paramGetLogger不是一个函数 | ||
* @deprecated 不建议使用,可以直接使用logManager的setCreateLog方法,设置创建函数 | ||
* @param {function} paramGetLogger 新的getLogger函数实现,替换getLogger | ||
@@ -173,0 +190,0 @@ * @return {boolean} 设置结果 |
@@ -1,34 +0,12 @@ | ||
import { SimpleCode, ISimpleCodeSeed, EnumSimpleCodeError } from './simplecode'; | ||
import { common_ret, ICommonRetData, ICommonMsgHead, XCommonRet } from './common_ret'; | ||
import { error_utils } from './common_error'; | ||
import { datetimeUtils } from './datetimeUtils'; | ||
import { codeUtils, IMD5Options } from './codeutils'; | ||
import { bitUtils, EnumBitConst } from './bitUtils'; | ||
import { utils } from './utils'; | ||
import { CNYCurrency } from './cnycurrency'; | ||
import { error_common, MemorySize, DatetimeConstant } from './constant'; | ||
import { watchRequire } from './watchrequire'; | ||
import { getLogger, ILog, logPrefix, setGetLogger } from './log'; | ||
import { EnumBufferSize, EnumBufferWapperError, BufferWapper} from './buffer_wapper'; | ||
// 导出依赖包 | ||
export { | ||
utils, | ||
bitUtils, | ||
EnumBitConst, | ||
CNYCurrency, | ||
error_common, | ||
MemorySize, | ||
codeUtils, | ||
IMD5Options, | ||
datetimeUtils, | ||
DatetimeConstant, | ||
error_utils, | ||
common_ret, ICommonRetData, ICommonMsgHead, XCommonRet, | ||
watchRequire, | ||
SimpleCode, | ||
ISimpleCodeSeed, | ||
EnumSimpleCodeError, | ||
EnumBufferSize, EnumBufferWapperError, BufferWapper, | ||
getLogger, setGetLogger, ILog, logPrefix, | ||
}; | ||
export * from './simplecode'; | ||
export * from './common_ret'; | ||
export * from './common_error'; | ||
export * from './datetimeUtils'; | ||
export * from './codeutils'; | ||
export * from './bitUtils'; | ||
export * from './utils'; | ||
export * from './cnycurrency'; | ||
export * from './constant'; | ||
export * from './watchrequire'; | ||
export * from './log'; | ||
export * from './buffer_wapper'; |
@@ -121,3 +121,3 @@ import path from 'path'; | ||
const log = new LogConsole('default'); | ||
let defaultLog: ILog = new LogConsole('default'); | ||
@@ -129,4 +129,5 @@ /** | ||
*/ | ||
export class LogManager { | ||
class LogManager { | ||
private m_MapLogger = new Map<string, ILog>(); | ||
private m_createLog: (paramTag:string) => ILog = (paramTag: string) => new LogConsole(paramTag); | ||
public constructor() { | ||
@@ -143,4 +144,3 @@ } | ||
if (utils.isNull(l)) { | ||
l = new LogConsole(paramTag); | ||
l = this.m_createLog(paramTag); | ||
this.m_MapLogger.set(paramTag, l); | ||
@@ -150,5 +150,13 @@ } | ||
} else { | ||
return log; | ||
return defaultLog; | ||
} | ||
} | ||
/** 设置缺省的log */ | ||
public setDefaultLog(paramDefaultLog: ILog) { | ||
defaultLog = paramDefaultLog; | ||
} | ||
/** 设置创建log */ | ||
public setCreateLog(paramCreateLog: (paramTag:string)=>ILog) { | ||
this.m_createLog = paramCreateLog; | ||
} | ||
} | ||
@@ -160,5 +168,14 @@ | ||
const logManager = new LogManager(); | ||
/** | ||
* @deprecated 不建议使用,可以直接使用logManager的setCreateLog方法,设置创建函数 | ||
*/ | ||
export type TGetLoggerFun = (paramTag: string) => ILog; | ||
/** | ||
* 取日志管理实例 | ||
* @returns | ||
*/ | ||
export function GetLogManager() { | ||
return logManager; | ||
} | ||
/** | ||
* 取指定tag的log | ||
@@ -187,2 +204,3 @@ * 如果没有这个tag的日志,则创建一个 | ||
* - 返回false表示paramGetLogger不是一个函数 | ||
* @deprecated 不建议使用,可以直接使用logManager的setCreateLog方法,设置创建函数 | ||
* @param {function} paramGetLogger 新的getLogger函数实现,替换getLogger | ||
@@ -189,0 +207,0 @@ * @return {boolean} 设置结果 |
{ | ||
"name": "xmcommon", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "javascript common lib for es6", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -40,2 +40,5 @@ # xmcommon | ||
## 0.9.8 | ||
- 2021-11-15 | ||
- \* 优化日志管理类,增加创建接口和设置猫缺省接口。 | ||
## 0.9.7 | ||
@@ -42,0 +45,0 @@ - 2021-11-12 |
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
8227
283
294858