MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / Logger

Class Logger

packages/utils/src/logger.ts:145–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143};
144
145class Logger {
146 bizName: string;
147 targetBizName: string;
148 targetLevel: string;
149 constructor(options: Options) {
150 options = { ...defaultOptions, ...options };
151 const _location = location || {} as any;
152 // __logConf__ 格式为 logLevel[:bizName], bizName is used as: targetBizName like '%bizName%'
153 // 1. __logConf__=log or __logConf__=warn, etc.
154 // 2. __logConf__=log:* or __logConf__=warn:*, etc.
155 // 2. __logConf__=log:bizName or __logConf__=warn:partOfBizName, etc.
156 const logConf = (((/__(?:logConf|logLevel)__=([^#/&]*)/.exec(_location.href)) || [])[1]);
157 const targetOptions = parseLogConf(logConf, options);
158 this.bizName = options.bizName;
159 this.targetBizName = targetOptions.bizName;
160 this.targetLevel = targetOptions.level;
161 }
162 debug(...args: any[]): void {
163 if (!shouldOutput('debug', this.targetLevel, this.bizName, this.targetBizName)) {
164 return;
165 }
166 return output('debug', this.bizName)(args);
167 }
168 log(...args: any[]): void {
169 if (!shouldOutput('log', this.targetLevel, this.bizName, this.targetBizName)) {
170 return;
171 }
172 return output('log', this.bizName)(args);
173 }
174 info(...args: any[]): void {
175 if (!shouldOutput('info', this.targetLevel, this.bizName, this.targetBizName)) {
176 return;
177 }
178 return output('info', this.bizName)(args);
179 }
180 warn(...args: any[]): void {
181 if (!shouldOutput('warn', this.targetLevel, this.bizName, this.targetBizName)) {
182 return;
183 }
184 return output('warn', this.bizName)(args);
185 }
186 error(...args: any[]): void {
187 if (!shouldOutput('error', this.targetLevel, this.bizName, this.targetBizName)) {
188 return;
189 }
190 return output('error', this.bizName)(args);
191 }
192}
193
194export { Logger };
195

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…