1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.loggerFrontendOnlyModule = void 0;
|
19 | const inversify_1 = require("inversify");
|
20 | const logger_protocol_1 = require("../common/logger-protocol");
|
21 | const logger_1 = require("../common/logger");
|
22 |
|
23 | exports.loggerFrontendOnlyModule = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
|
24 | const logger = {
|
25 | setLogLevel: async (_name, _logLevel) => { },
|
26 | getLogLevel: async (_name) => logger_protocol_1.LogLevel.INFO,
|
27 | log: async (name, logLevel, message, params) => {
|
28 | logger_protocol_1.ConsoleLogger.log(name, logLevel, message, params);
|
29 | },
|
30 | child: async (_name) => { },
|
31 | dispose: () => {
|
32 | },
|
33 | setClient: (_client) => {
|
34 | }
|
35 | };
|
36 | if (isBound(logger_protocol_1.ILoggerServer)) {
|
37 | rebind(logger_protocol_1.ILoggerServer).toConstantValue(logger);
|
38 | }
|
39 | else {
|
40 | bind(logger_protocol_1.ILoggerServer).toConstantValue(logger);
|
41 | }
|
42 | if (isBound(logger_protocol_1.ILoggerServer)) {
|
43 | rebind(logger_1.LoggerFactory).toFactory(ctx => (name) => {
|
44 | const child = new inversify_1.Container({ defaultScope: 'Singleton' });
|
45 | child.parent = ctx.container;
|
46 | child.bind(logger_1.ILogger).to(logger_1.Logger).inTransientScope();
|
47 | child.bind(logger_1.LoggerName).toConstantValue(name);
|
48 | return child.get(logger_1.ILogger);
|
49 | });
|
50 | }
|
51 | else {
|
52 | bind(logger_1.LoggerFactory).toFactory(ctx => (name) => {
|
53 | const child = new inversify_1.Container({ defaultScope: 'Singleton' });
|
54 | child.parent = ctx.container;
|
55 | child.bind(logger_1.ILogger).to(logger_1.Logger).inTransientScope();
|
56 | child.bind(logger_1.LoggerName).toConstantValue(name);
|
57 | return child.get(logger_1.ILogger);
|
58 | });
|
59 | }
|
60 | });
|
61 |
|
\ | No newline at end of file |