feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,7 @@
import { Logger } from './types/Logger';
import { LogRecord } from './types/LogRecord';
export declare class NoopLogger implements Logger {
emit(_logRecord: LogRecord): void;
}
export declare const NOOP_LOGGER: NoopLogger;
//# sourceMappingURL=NoopLogger.d.ts.map

View File

@@ -0,0 +1,24 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var NoopLogger = /** @class */ (function () {
function NoopLogger() {
}
NoopLogger.prototype.emit = function (_logRecord) { };
return NoopLogger;
}());
export { NoopLogger };
export var NOOP_LOGGER = new NoopLogger();
//# sourceMappingURL=NoopLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLogger.js","sourceRoot":"","sources":["../../src/NoopLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;IAAA;IAEA,CAAC;IADC,yBAAI,GAAJ,UAAK,UAAqB,IAAS,CAAC;IACtC,iBAAC;AAAD,CAAC,AAFD,IAEC;;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from './types/Logger';\nimport { LogRecord } from './types/LogRecord';\n\nexport class NoopLogger implements Logger {\n emit(_logRecord: LogRecord): void {}\n}\n\nexport const NOOP_LOGGER = new NoopLogger();\n"]}

View File

@@ -0,0 +1,8 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class NoopLoggerProvider implements LoggerProvider {
getLogger(_name: string, _version?: string | undefined, _options?: LoggerOptions | undefined): Logger;
}
export declare const NOOP_LOGGER_PROVIDER: NoopLoggerProvider;
//# sourceMappingURL=NoopLoggerProvider.d.ts.map

View File

@@ -0,0 +1,27 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NoopLogger } from './NoopLogger';
var NoopLoggerProvider = /** @class */ (function () {
function NoopLoggerProvider() {
}
NoopLoggerProvider.prototype.getLogger = function (_name, _version, _options) {
return new NoopLogger();
};
return NoopLoggerProvider;
}());
export { NoopLoggerProvider };
export var NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();
//# sourceMappingURL=NoopLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLoggerProvider.js","sourceRoot":"","sources":["../../src/NoopLoggerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;IAAA;IAQA,CAAC;IAPC,sCAAS,GAAT,UACE,KAAa,EACb,QAA6B,EAC7B,QAAoC;QAEpC,OAAO,IAAI,UAAU,EAAE,CAAC;IAC1B,CAAC;IACH,yBAAC;AAAD,CAAC,AARD,IAQC;;AAED,MAAM,CAAC,IAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NoopLogger } from './NoopLogger';\n\nexport class NoopLoggerProvider implements LoggerProvider {\n getLogger(\n _name: string,\n _version?: string | undefined,\n _options?: LoggerOptions | undefined\n ): Logger {\n return new NoopLogger();\n }\n}\n\nexport const NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();\n"]}

View File

@@ -0,0 +1,26 @@
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
import { LogRecord } from './types/LogRecord';
export declare class ProxyLogger implements Logger {
private _provider;
readonly name: string;
readonly version?: string | undefined;
readonly options?: LoggerOptions | undefined;
private _delegate?;
constructor(_provider: LoggerDelegator, name: string, version?: string | undefined, options?: LoggerOptions | undefined);
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
private _getLogger;
}
export interface LoggerDelegator {
getDelegateLogger(name: string, version?: string, options?: LoggerOptions): Logger | undefined;
}
//# sourceMappingURL=ProxyLogger.d.ts.map

View File

@@ -0,0 +1,50 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NOOP_LOGGER } from './NoopLogger';
var ProxyLogger = /** @class */ (function () {
function ProxyLogger(_provider, name, version, options) {
this._provider = _provider;
this.name = name;
this.version = version;
this.options = options;
}
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
ProxyLogger.prototype.emit = function (logRecord) {
this._getLogger().emit(logRecord);
};
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
ProxyLogger.prototype._getLogger = function () {
if (this._delegate) {
return this._delegate;
}
var logger = this._provider.getDelegateLogger(this.name, this.version, this.options);
if (!logger) {
return NOOP_LOGGER;
}
this._delegate = logger;
return this._delegate;
};
return ProxyLogger;
}());
export { ProxyLogger };
//# sourceMappingURL=ProxyLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLogger.js","sourceRoot":"","sources":["../../src/ProxyLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C;IAIE,qBACU,SAA0B,EAClB,IAAY,EACZ,OAA4B,EAC5B,OAAmC;QAH3C,cAAS,GAAT,SAAS,CAAiB;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAA4B;IAClD,CAAC;IAEJ;;;;OAIG;IACH,0BAAI,GAAJ,UAAK,SAAoB;QACvB,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACK,gCAAU,GAAlB;QACE,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QACD,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QACF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACH,kBAAC;AAAD,CAAC,AAvCD,IAuCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NOOP_LOGGER } from './NoopLogger';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { LogRecord } from './types/LogRecord';\n\nexport class ProxyLogger implements Logger {\n // When a real implementation is provided, this will be it\n private _delegate?: Logger;\n\n constructor(\n private _provider: LoggerDelegator,\n public readonly name: string,\n public readonly version?: string | undefined,\n public readonly options?: LoggerOptions | undefined\n ) {}\n\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void {\n this._getLogger().emit(logRecord);\n }\n\n /**\n * Try to get a logger from the proxy logger provider.\n * If the proxy logger provider has no delegate, return a noop logger.\n */\n private _getLogger() {\n if (this._delegate) {\n return this._delegate;\n }\n const logger = this._provider.getDelegateLogger(\n this.name,\n this.version,\n this.options\n );\n if (!logger) {\n return NOOP_LOGGER;\n }\n this._delegate = logger;\n return this._delegate;\n }\n}\n\nexport interface LoggerDelegator {\n getDelegateLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger | undefined;\n}\n"]}

View File

@@ -0,0 +1,14 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class ProxyLoggerProvider implements LoggerProvider {
private _delegate?;
getLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger;
getDelegate(): LoggerProvider;
/**
* Set the delegate logger provider
*/
setDelegate(delegate: LoggerProvider): void;
getDelegateLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger | undefined;
}
//# sourceMappingURL=ProxyLoggerProvider.d.ts.map

View File

@@ -0,0 +1,42 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';
import { ProxyLogger } from './ProxyLogger';
var ProxyLoggerProvider = /** @class */ (function () {
function ProxyLoggerProvider() {
}
ProxyLoggerProvider.prototype.getLogger = function (name, version, options) {
var _a;
return ((_a = this.getDelegateLogger(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyLogger(this, name, version, options));
};
ProxyLoggerProvider.prototype.getDelegate = function () {
var _a;
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_LOGGER_PROVIDER;
};
/**
* Set the delegate logger provider
*/
ProxyLoggerProvider.prototype.setDelegate = function (delegate) {
this._delegate = delegate;
};
ProxyLoggerProvider.prototype.getDelegateLogger = function (name, version, options) {
var _a;
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version, options);
};
return ProxyLoggerProvider;
}());
export { ProxyLoggerProvider };
//# sourceMappingURL=ProxyLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLoggerProvider.js","sourceRoot":"","sources":["../../src/ProxyLoggerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;IAAA;IAgCA,CAAC;IA7BC,uCAAS,GAAT,UACE,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,yCAAW,GAAX;;QACE,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,yCAAW,GAAX,UAAY,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,+CAAiB,GAAjB,UACE,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IACH,0BAAC;AAAD,CAAC,AAhCD,IAgCC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';\nimport { ProxyLogger } from './ProxyLogger';\n\nexport class ProxyLoggerProvider implements LoggerProvider {\n private _delegate?: LoggerProvider;\n\n getLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger {\n return (\n this.getDelegateLogger(name, version, options) ??\n new ProxyLogger(this, name, version, options)\n );\n }\n\n getDelegate(): LoggerProvider {\n return this._delegate ?? NOOP_LOGGER_PROVIDER;\n }\n\n /**\n * Set the delegate logger provider\n */\n setDelegate(delegate: LoggerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger | undefined {\n return this._delegate?.getLogger(name, version, options);\n }\n}\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
import { Logger } from '../types/Logger';
import { LoggerOptions } from '../types/LoggerOptions';
export declare class LogsAPI {
private static _instance?;
private _proxyLoggerProvider;
private constructor();
static getInstance(): LogsAPI;
setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider;
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
getLoggerProvider(): LoggerProvider;
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
getLogger(name: string, version?: string, options?: LoggerOptions): Logger;
/** Remove the global logger provider */
disable(): void;
}
//# sourceMappingURL=logs.d.ts.map

View File

@@ -0,0 +1,62 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { API_BACKWARDS_COMPATIBILITY_VERSION, GLOBAL_LOGS_API_KEY, _global, makeGetter, } from '../internal/global-utils';
import { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';
import { ProxyLoggerProvider } from '../ProxyLoggerProvider';
var LogsAPI = /** @class */ (function () {
function LogsAPI() {
this._proxyLoggerProvider = new ProxyLoggerProvider();
}
LogsAPI.getInstance = function () {
if (!this._instance) {
this._instance = new LogsAPI();
}
return this._instance;
};
LogsAPI.prototype.setGlobalLoggerProvider = function (provider) {
if (_global[GLOBAL_LOGS_API_KEY]) {
return this.getLoggerProvider();
}
_global[GLOBAL_LOGS_API_KEY] = makeGetter(API_BACKWARDS_COMPATIBILITY_VERSION, provider, NOOP_LOGGER_PROVIDER);
this._proxyLoggerProvider.setDelegate(provider);
return provider;
};
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
LogsAPI.prototype.getLoggerProvider = function () {
var _a, _b;
return ((_b = (_a = _global[GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(_global, API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider);
};
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
LogsAPI.prototype.getLogger = function (name, version, options) {
return this.getLoggerProvider().getLogger(name, version, options);
};
/** Remove the global logger provider */
LogsAPI.prototype.disable = function () {
delete _global[GLOBAL_LOGS_API_KEY];
this._proxyLoggerProvider = new ProxyLoggerProvider();
};
return LogsAPI;
}());
export { LogsAPI };
//# sourceMappingURL=logs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/api/logs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mCAAmC,EACnC,mBAAmB,EACnB,OAAO,EACP,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;IAKE;QAFQ,yBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAElC,CAAC;IAEV,mBAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,yCAAuB,GAA9B,UAA+B,QAAwB;QACrD,IAAI,OAAO,CAAC,mBAAmB,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;SACjC;QAED,OAAO,CAAC,mBAAmB,CAAC,GAAG,UAAU,CACvC,mCAAmC,EACnC,QAAQ,EACR,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACI,mCAAiB,GAAxB;;QACE,OAAO,CACL,MAAA,MAAA,OAAO,CAAC,mBAAmB,CAAC,+CAA5B,OAAO,EAAwB,mCAAmC,CAAC,mCACnE,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,2BAAS,GAAhB,UACE,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,wCAAwC;IACjC,yBAAO,GAAd;QACE,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpC,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxD,CAAC;IACH,cAAC;AAAD,CAAC,AA5DD,IA4DC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n API_BACKWARDS_COMPATIBILITY_VERSION,\n GLOBAL_LOGS_API_KEY,\n _global,\n makeGetter,\n} from '../internal/global-utils';\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';\nimport { Logger } from '../types/Logger';\nimport { LoggerOptions } from '../types/LoggerOptions';\nimport { ProxyLoggerProvider } from '../ProxyLoggerProvider';\n\nexport class LogsAPI {\n private static _instance?: LogsAPI;\n\n private _proxyLoggerProvider = new ProxyLoggerProvider();\n\n private constructor() {}\n\n public static getInstance(): LogsAPI {\n if (!this._instance) {\n this._instance = new LogsAPI();\n }\n\n return this._instance;\n }\n\n public setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider {\n if (_global[GLOBAL_LOGS_API_KEY]) {\n return this.getLoggerProvider();\n }\n\n _global[GLOBAL_LOGS_API_KEY] = makeGetter<LoggerProvider>(\n API_BACKWARDS_COMPATIBILITY_VERSION,\n provider,\n NOOP_LOGGER_PROVIDER\n );\n this._proxyLoggerProvider.setDelegate(provider);\n\n return provider;\n }\n\n /**\n * Returns the global logger provider.\n *\n * @returns LoggerProvider\n */\n public getLoggerProvider(): LoggerProvider {\n return (\n _global[GLOBAL_LOGS_API_KEY]?.(API_BACKWARDS_COMPATIBILITY_VERSION) ??\n this._proxyLoggerProvider\n );\n }\n\n /**\n * Returns a logger from the global logger provider.\n *\n * @returns Logger\n */\n public getLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger {\n return this.getLoggerProvider().getLogger(name, version, options);\n }\n\n /** Remove the global logger provider */\n public disable(): void {\n delete _global[GLOBAL_LOGS_API_KEY];\n this._proxyLoggerProvider = new ProxyLoggerProvider();\n }\n}\n"]}

View File

@@ -0,0 +1,12 @@
export { Logger } from './types/Logger';
export { LoggerProvider } from './types/LoggerProvider';
export { LogAttributes, LogBody, LogRecord, SeverityNumber, } from './types/LogRecord';
export { LoggerOptions } from './types/LoggerOptions';
export { AnyValue, AnyValueMap } from './types/AnyValue';
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
export { ProxyLogger } from './ProxyLogger';
export { ProxyLoggerProvider } from './ProxyLoggerProvider';
import { LogsAPI } from './api/logs';
export declare const logs: LogsAPI;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { SeverityNumber, } from './types/LogRecord';
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
export { ProxyLogger } from './ProxyLogger';
export { ProxyLoggerProvider } from './ProxyLoggerProvider';
import { LogsAPI } from './api/logs';
export var logs = LogsAPI.getInstance();
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAIL,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,CAAC,IAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { Logger } from './types/Logger';\nexport { LoggerProvider } from './types/LoggerProvider';\nexport {\n LogAttributes,\n LogBody,\n LogRecord,\n SeverityNumber,\n} from './types/LogRecord';\nexport { LoggerOptions } from './types/LoggerOptions';\nexport { AnyValue, AnyValueMap } from './types/AnyValue';\nexport { NOOP_LOGGER, NoopLogger } from './NoopLogger';\nexport { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';\nexport { ProxyLogger } from './ProxyLogger';\nexport { ProxyLoggerProvider } from './ProxyLoggerProvider';\n\nimport { LogsAPI } from './api/logs';\nexport const logs = LogsAPI.getInstance();\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
export declare const GLOBAL_LOGS_API_KEY: unique symbol;
declare type Get<T> = (version: number) => T;
export declare const _global: Partial<{
[GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;
}>;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
export declare function makeGetter<T>(requiredVersion: number, instance: T, fallback: T): Get<T>;
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
export declare const API_BACKWARDS_COMPATIBILITY_VERSION = 1;
export {};
//# sourceMappingURL=global-utils.d.ts.map

View File

@@ -0,0 +1,40 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { _globalThis } from '../platform';
export var GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');
export var _global = _globalThis;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
export function makeGetter(requiredVersion, instance, fallback) {
return function (version) {
return version === requiredVersion ? instance : fallback;
};
}
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
export var API_BACKWARDS_COMPATIBILITY_VERSION = 1;
//# sourceMappingURL=global-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,IAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAO9E,MAAM,CAAC,IAAM,OAAO,GAAG,WAAyB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,eAAuB,EACvB,QAAW,EACX,QAAW;IAEX,OAAO,UAAC,OAAe;QACrB,OAAA,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;IAAjD,CAAiD,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,mCAAmC,GAAG,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { _globalThis } from '../platform';\n\nexport const GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');\n\ntype Get<T> = (version: number) => T;\ntype OtelGlobal = Partial<{\n [GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;\n}>;\n\nexport const _global = _globalThis as OtelGlobal;\n\n/**\n * Make a function which accepts a version integer and returns the instance of an API if the version\n * is compatible, or a fallback version (usually NOOP) if it is not.\n *\n * @param requiredVersion Backwards compatibility version which is required to return the instance\n * @param instance Instance which should be returned if the required version is compatible\n * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible\n */\nexport function makeGetter<T>(\n requiredVersion: number,\n instance: T,\n fallback: T\n): Get<T> {\n return (version: number): T =>\n version === requiredVersion ? instance : fallback;\n}\n\n/**\n * A number which should be incremented each time a backwards incompatible\n * change is made to the API. This number is used when an API package\n * attempts to access the global API to ensure it is getting a compatible\n * version. If the global API is not compatible with the API package\n * attempting to get it, a NOOP API implementation will be returned.\n */\nexport const API_BACKWARDS_COMPATIBILITY_VERSION = 1;\n"]}

View File

@@ -0,0 +1,10 @@
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,36 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Updates to this file should also be replicated to @opentelemetry/api and
// @opentelemetry/core too.
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
export var _globalThis = typeof globalThis === 'object'
? globalThis
: typeof self === 'object'
? self
: typeof window === 'object'
? window
: typeof global === 'object'
? global
: {};
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2EAA2E;AAC3E,2BAA2B;AAE3B;;;;;;GAMG;AAEH,gEAAgE;AAChE,8EAA8E;AAC9E,MAAM,CAAC,IAAM,WAAW,GACtB,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAE,EAAwB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Updates to this file should also be replicated to @opentelemetry/api and\n// @opentelemetry/core too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './node';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './node';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './node';\n"]}

View File

@@ -0,0 +1,3 @@
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins
export var _globalThis = typeof globalThis === 'object' ? globalThis : global;
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/node/globalThis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gEAAgE;AAChE,oEAAoE;AACpE,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins\nexport const _globalThis = typeof globalThis === 'object' ? globalThis : global;\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,18 @@
export declare type AnyValueScalar = string | number | boolean;
export declare type AnyValueArray = Array<AnyValue>;
/**
* AnyValueMap is a map from string to AnyValue (attribute value or a nested map)
*/
export interface AnyValueMap {
[attributeKey: string]: AnyValue;
}
/**
* AnyValue can be one of the following:
* - a scalar value
* - a byte array
* - array of any value
* - map from string to any value
* - empty value
*/
export declare type AnyValue = AnyValueScalar | Uint8Array | AnyValueArray | AnyValueMap | null | undefined;
//# sourceMappingURL=AnyValue.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};
//# sourceMappingURL=AnyValue.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AnyValue.js","sourceRoot":"","sources":["../../../src/types/AnyValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type AnyValueScalar = string | number | boolean;\n\nexport type AnyValueArray = Array<AnyValue>;\n\n/**\n * AnyValueMap is a map from string to AnyValue (attribute value or a nested map)\n */\nexport interface AnyValueMap {\n [attributeKey: string]: AnyValue;\n}\n\n/**\n * AnyValue can be one of the following:\n * - a scalar value\n * - a byte array\n * - array of any value\n * - map from string to any value\n * - empty value\n */\nexport type AnyValue =\n | AnyValueScalar\n | Uint8Array\n | AnyValueArray\n | AnyValueMap\n | null\n | undefined;\n"]}

View File

@@ -0,0 +1,62 @@
import { Context, TimeInput } from '@opentelemetry/api';
import { AnyValue, AnyValueMap } from './AnyValue';
export declare type LogBody = AnyValue;
export declare type LogAttributes = AnyValueMap;
export declare enum SeverityNumber {
UNSPECIFIED = 0,
TRACE = 1,
TRACE2 = 2,
TRACE3 = 3,
TRACE4 = 4,
DEBUG = 5,
DEBUG2 = 6,
DEBUG3 = 7,
DEBUG4 = 8,
INFO = 9,
INFO2 = 10,
INFO3 = 11,
INFO4 = 12,
WARN = 13,
WARN2 = 14,
WARN3 = 15,
WARN4 = 16,
ERROR = 17,
ERROR2 = 18,
ERROR3 = 19,
ERROR4 = 20,
FATAL = 21,
FATAL2 = 22,
FATAL3 = 23,
FATAL4 = 24
}
export interface LogRecord {
/**
* The time when the log record occurred as UNIX Epoch time in nanoseconds.
*/
timestamp?: TimeInput;
/**
* Time when the event was observed by the collection system.
*/
observedTimestamp?: TimeInput;
/**
* Numerical value of the severity.
*/
severityNumber?: SeverityNumber;
/**
* The severity text.
*/
severityText?: string;
/**
* A value containing the body of the log record.
*/
body?: LogBody;
/**
* Attributes that define the log record.
*/
attributes?: LogAttributes;
/**
* The Context associated with the LogRecord.
*/
context?: Context;
}
//# sourceMappingURL=LogRecord.d.ts.map

View File

@@ -0,0 +1,44 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export var SeverityNumber;
(function (SeverityNumber) {
SeverityNumber[SeverityNumber["UNSPECIFIED"] = 0] = "UNSPECIFIED";
SeverityNumber[SeverityNumber["TRACE"] = 1] = "TRACE";
SeverityNumber[SeverityNumber["TRACE2"] = 2] = "TRACE2";
SeverityNumber[SeverityNumber["TRACE3"] = 3] = "TRACE3";
SeverityNumber[SeverityNumber["TRACE4"] = 4] = "TRACE4";
SeverityNumber[SeverityNumber["DEBUG"] = 5] = "DEBUG";
SeverityNumber[SeverityNumber["DEBUG2"] = 6] = "DEBUG2";
SeverityNumber[SeverityNumber["DEBUG3"] = 7] = "DEBUG3";
SeverityNumber[SeverityNumber["DEBUG4"] = 8] = "DEBUG4";
SeverityNumber[SeverityNumber["INFO"] = 9] = "INFO";
SeverityNumber[SeverityNumber["INFO2"] = 10] = "INFO2";
SeverityNumber[SeverityNumber["INFO3"] = 11] = "INFO3";
SeverityNumber[SeverityNumber["INFO4"] = 12] = "INFO4";
SeverityNumber[SeverityNumber["WARN"] = 13] = "WARN";
SeverityNumber[SeverityNumber["WARN2"] = 14] = "WARN2";
SeverityNumber[SeverityNumber["WARN3"] = 15] = "WARN3";
SeverityNumber[SeverityNumber["WARN4"] = 16] = "WARN4";
SeverityNumber[SeverityNumber["ERROR"] = 17] = "ERROR";
SeverityNumber[SeverityNumber["ERROR2"] = 18] = "ERROR2";
SeverityNumber[SeverityNumber["ERROR3"] = 19] = "ERROR3";
SeverityNumber[SeverityNumber["ERROR4"] = 20] = "ERROR4";
SeverityNumber[SeverityNumber["FATAL"] = 21] = "FATAL";
SeverityNumber[SeverityNumber["FATAL2"] = 22] = "FATAL2";
SeverityNumber[SeverityNumber["FATAL3"] = 23] = "FATAL3";
SeverityNumber[SeverityNumber["FATAL4"] = 24] = "FATAL4";
})(SeverityNumber || (SeverityNumber = {}));
//# sourceMappingURL=LogRecord.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LogRecord.js","sourceRoot":"","sources":["../../../src/types/LogRecord.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,MAAM,CAAN,IAAY,cA0BX;AA1BD,WAAY,cAAc;IACxB,iEAAe,CAAA;IACf,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,oDAAS,CAAA;IACT,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;AACb,CAAC,EA1BW,cAAc,KAAd,cAAc,QA0BzB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context, TimeInput } from '@opentelemetry/api';\nimport { AnyValue, AnyValueMap } from './AnyValue';\n\nexport type LogBody = AnyValue;\nexport type LogAttributes = AnyValueMap;\n\nexport enum SeverityNumber {\n UNSPECIFIED = 0,\n TRACE = 1,\n TRACE2 = 2,\n TRACE3 = 3,\n TRACE4 = 4,\n DEBUG = 5,\n DEBUG2 = 6,\n DEBUG3 = 7,\n DEBUG4 = 8,\n INFO = 9,\n INFO2 = 10,\n INFO3 = 11,\n INFO4 = 12,\n WARN = 13,\n WARN2 = 14,\n WARN3 = 15,\n WARN4 = 16,\n ERROR = 17,\n ERROR2 = 18,\n ERROR3 = 19,\n ERROR4 = 20,\n FATAL = 21,\n FATAL2 = 22,\n FATAL3 = 23,\n FATAL4 = 24,\n}\n\nexport interface LogRecord {\n /**\n * The time when the log record occurred as UNIX Epoch time in nanoseconds.\n */\n timestamp?: TimeInput;\n\n /**\n * Time when the event was observed by the collection system.\n */\n observedTimestamp?: TimeInput;\n\n /**\n * Numerical value of the severity.\n */\n severityNumber?: SeverityNumber;\n\n /**\n * The severity text.\n */\n severityText?: string;\n\n /**\n * A value containing the body of the log record.\n */\n body?: LogBody;\n\n /**\n * Attributes that define the log record.\n */\n attributes?: LogAttributes;\n\n /**\n * The Context associated with the LogRecord.\n */\n context?: Context;\n}\n"]}

View File

@@ -0,0 +1,10 @@
import { LogRecord } from './LogRecord';
export interface Logger {
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
}
//# sourceMappingURL=Logger.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};
//# sourceMappingURL=Logger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/types/Logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogRecord } from './LogRecord';\n\nexport interface Logger {\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void;\n}\n"]}

View File

@@ -0,0 +1,18 @@
import { Attributes } from '@opentelemetry/api';
export interface LoggerOptions {
/**
* The schemaUrl of the tracer or instrumentation library
* @default ''
*/
schemaUrl?: string;
/**
* The instrumentation scope attributes to associate with emitted telemetry
*/
scopeAttributes?: Attributes;
/**
* Specifies whether the Trace Context should automatically be passed on to the LogRecords emitted by the Logger.
* @default true
*/
includeTraceContext?: boolean;
}
//# sourceMappingURL=LoggerOptions.d.ts.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=LoggerOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoggerOptions.js","sourceRoot":"","sources":["../../../src/types/LoggerOptions.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Attributes } from '@opentelemetry/api';\nexport interface LoggerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n * @default ''\n */\n schemaUrl?: string;\n\n /**\n * The instrumentation scope attributes to associate with emitted telemetry\n */\n scopeAttributes?: Attributes;\n\n /**\n * Specifies whether the Trace Context should automatically be passed on to the LogRecords emitted by the Logger.\n * @default true\n */\n includeTraceContext?: boolean;\n}\n"]}

View File

@@ -0,0 +1,18 @@
import { Logger } from './Logger';
import { LoggerOptions } from './LoggerOptions';
/**
* A registry for creating named {@link Logger}s.
*/
export interface LoggerProvider {
/**
* Returns a Logger, creating one if one with the given name, version, and
* schemaUrl pair is not already created.
*
* @param name The name of the logger or instrumentation library.
* @param version The version of the logger or instrumentation library.
* @param options The options of the logger or instrumentation library.
* @returns Logger A Logger with the given name and version
*/
getLogger(name: string, version?: string, options?: LoggerOptions): Logger;
}
//# sourceMappingURL=LoggerProvider.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};
//# sourceMappingURL=LoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoggerProvider.js","sourceRoot":"","sources":["../../../src/types/LoggerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from './Logger';\nimport { LoggerOptions } from './LoggerOptions';\n\n/**\n * A registry for creating named {@link Logger}s.\n */\nexport interface LoggerProvider {\n /**\n * Returns a Logger, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the logger or instrumentation library.\n * @param version The version of the logger or instrumentation library.\n * @param options The options of the logger or instrumentation library.\n * @returns Logger A Logger with the given name and version\n */\n getLogger(name: string, version?: string, options?: LoggerOptions): Logger;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "0.57.2";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1,18 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// this is autogenerated file, see scripts/version-update.js
export var VERSION = '0.57.2';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.57.2';\n"]}

View File

@@ -0,0 +1,7 @@
import { Logger } from './types/Logger';
import { LogRecord } from './types/LogRecord';
export declare class NoopLogger implements Logger {
emit(_logRecord: LogRecord): void;
}
export declare const NOOP_LOGGER: NoopLogger;
//# sourceMappingURL=NoopLogger.d.ts.map

View File

@@ -0,0 +1,20 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class NoopLogger {
emit(_logRecord) { }
}
export const NOOP_LOGGER = new NoopLogger();
//# sourceMappingURL=NoopLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLogger.js","sourceRoot":"","sources":["../../src/NoopLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,UAAU;IACrB,IAAI,CAAC,UAAqB,IAAS,CAAC;CACrC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from './types/Logger';\nimport { LogRecord } from './types/LogRecord';\n\nexport class NoopLogger implements Logger {\n emit(_logRecord: LogRecord): void {}\n}\n\nexport const NOOP_LOGGER = new NoopLogger();\n"]}

View File

@@ -0,0 +1,8 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class NoopLoggerProvider implements LoggerProvider {
getLogger(_name: string, _version?: string | undefined, _options?: LoggerOptions | undefined): Logger;
}
export declare const NOOP_LOGGER_PROVIDER: NoopLoggerProvider;
//# sourceMappingURL=NoopLoggerProvider.d.ts.map

View File

@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NoopLogger } from './NoopLogger';
export class NoopLoggerProvider {
getLogger(_name, _version, _options) {
return new NoopLogger();
}
}
export const NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();
//# sourceMappingURL=NoopLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopLoggerProvider.js","sourceRoot":"","sources":["../../src/NoopLoggerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,OAAO,kBAAkB;IAC7B,SAAS,CACP,KAAa,EACb,QAA6B,EAC7B,QAAoC;QAEpC,OAAO,IAAI,UAAU,EAAE,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NoopLogger } from './NoopLogger';\n\nexport class NoopLoggerProvider implements LoggerProvider {\n getLogger(\n _name: string,\n _version?: string | undefined,\n _options?: LoggerOptions | undefined\n ): Logger {\n return new NoopLogger();\n }\n}\n\nexport const NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();\n"]}

View File

@@ -0,0 +1,26 @@
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
import { LogRecord } from './types/LogRecord';
export declare class ProxyLogger implements Logger {
private _provider;
readonly name: string;
readonly version?: string | undefined;
readonly options?: LoggerOptions | undefined;
private _delegate?;
constructor(_provider: LoggerDelegator, name: string, version?: string | undefined, options?: LoggerOptions | undefined);
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
private _getLogger;
}
export interface LoggerDelegator {
getDelegateLogger(name: string, version?: string, options?: LoggerOptions): Logger | undefined;
}
//# sourceMappingURL=ProxyLogger.d.ts.map

View File

@@ -0,0 +1,48 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NOOP_LOGGER } from './NoopLogger';
export class ProxyLogger {
constructor(_provider, name, version, options) {
this._provider = _provider;
this.name = name;
this.version = version;
this.options = options;
}
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord) {
this._getLogger().emit(logRecord);
}
/**
* Try to get a logger from the proxy logger provider.
* If the proxy logger provider has no delegate, return a noop logger.
*/
_getLogger() {
if (this._delegate) {
return this._delegate;
}
const logger = this._provider.getDelegateLogger(this.name, this.version, this.options);
if (!logger) {
return NOOP_LOGGER;
}
this._delegate = logger;
return this._delegate;
}
}
//# sourceMappingURL=ProxyLogger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLogger.js","sourceRoot":"","sources":["../../src/ProxyLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,MAAM,OAAO,WAAW;IAItB,YACU,SAA0B,EAClB,IAAY,EACZ,OAA4B,EAC5B,OAAmC;QAH3C,cAAS,GAAT,SAAS,CAAiB;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAA4B;IAClD,CAAC;IAEJ;;;;OAIG;IACH,IAAI,CAAC,SAAoB;QACvB,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAC7C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO,CACb,CAAC;QACF,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NOOP_LOGGER } from './NoopLogger';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { LogRecord } from './types/LogRecord';\n\nexport class ProxyLogger implements Logger {\n // When a real implementation is provided, this will be it\n private _delegate?: Logger;\n\n constructor(\n private _provider: LoggerDelegator,\n public readonly name: string,\n public readonly version?: string | undefined,\n public readonly options?: LoggerOptions | undefined\n ) {}\n\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void {\n this._getLogger().emit(logRecord);\n }\n\n /**\n * Try to get a logger from the proxy logger provider.\n * If the proxy logger provider has no delegate, return a noop logger.\n */\n private _getLogger() {\n if (this._delegate) {\n return this._delegate;\n }\n const logger = this._provider.getDelegateLogger(\n this.name,\n this.version,\n this.options\n );\n if (!logger) {\n return NOOP_LOGGER;\n }\n this._delegate = logger;\n return this._delegate;\n }\n}\n\nexport interface LoggerDelegator {\n getDelegateLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger | undefined;\n}\n"]}

View File

@@ -0,0 +1,14 @@
import { LoggerProvider } from './types/LoggerProvider';
import { Logger } from './types/Logger';
import { LoggerOptions } from './types/LoggerOptions';
export declare class ProxyLoggerProvider implements LoggerProvider {
private _delegate?;
getLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger;
getDelegate(): LoggerProvider;
/**
* Set the delegate logger provider
*/
setDelegate(delegate: LoggerProvider): void;
getDelegateLogger(name: string, version?: string | undefined, options?: LoggerOptions | undefined): Logger | undefined;
}
//# sourceMappingURL=ProxyLoggerProvider.d.ts.map

View File

@@ -0,0 +1,38 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';
import { ProxyLogger } from './ProxyLogger';
export class ProxyLoggerProvider {
getLogger(name, version, options) {
var _a;
return ((_a = this.getDelegateLogger(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyLogger(this, name, version, options));
}
getDelegate() {
var _a;
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_LOGGER_PROVIDER;
}
/**
* Set the delegate logger provider
*/
setDelegate(delegate) {
this._delegate = delegate;
}
getDelegateLogger(name, version, options) {
var _a;
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version, options);
}
}
//# sourceMappingURL=ProxyLoggerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProxyLoggerProvider.js","sourceRoot":"","sources":["../../src/ProxyLoggerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,OAAO,mBAAmB;IAG9B,SAAS,CACP,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,mCAC9C,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC;IACJ,CAAC;IAED,WAAW;;QACT,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,iBAAiB,CACf,IAAY,EACZ,OAA4B,EAC5B,OAAmC;;QAEnC,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from './types/LoggerProvider';\nimport { Logger } from './types/Logger';\nimport { LoggerOptions } from './types/LoggerOptions';\nimport { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';\nimport { ProxyLogger } from './ProxyLogger';\n\nexport class ProxyLoggerProvider implements LoggerProvider {\n private _delegate?: LoggerProvider;\n\n getLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger {\n return (\n this.getDelegateLogger(name, version, options) ??\n new ProxyLogger(this, name, version, options)\n );\n }\n\n getDelegate(): LoggerProvider {\n return this._delegate ?? NOOP_LOGGER_PROVIDER;\n }\n\n /**\n * Set the delegate logger provider\n */\n setDelegate(delegate: LoggerProvider) {\n this._delegate = delegate;\n }\n\n getDelegateLogger(\n name: string,\n version?: string | undefined,\n options?: LoggerOptions | undefined\n ): Logger | undefined {\n return this._delegate?.getLogger(name, version, options);\n }\n}\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
import { Logger } from '../types/Logger';
import { LoggerOptions } from '../types/LoggerOptions';
export declare class LogsAPI {
private static _instance?;
private _proxyLoggerProvider;
private constructor();
static getInstance(): LogsAPI;
setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider;
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
getLoggerProvider(): LoggerProvider;
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
getLogger(name: string, version?: string, options?: LoggerOptions): Logger;
/** Remove the global logger provider */
disable(): void;
}
//# sourceMappingURL=logs.d.ts.map

View File

@@ -0,0 +1,60 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { API_BACKWARDS_COMPATIBILITY_VERSION, GLOBAL_LOGS_API_KEY, _global, makeGetter, } from '../internal/global-utils';
import { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';
import { ProxyLoggerProvider } from '../ProxyLoggerProvider';
export class LogsAPI {
constructor() {
this._proxyLoggerProvider = new ProxyLoggerProvider();
}
static getInstance() {
if (!this._instance) {
this._instance = new LogsAPI();
}
return this._instance;
}
setGlobalLoggerProvider(provider) {
if (_global[GLOBAL_LOGS_API_KEY]) {
return this.getLoggerProvider();
}
_global[GLOBAL_LOGS_API_KEY] = makeGetter(API_BACKWARDS_COMPATIBILITY_VERSION, provider, NOOP_LOGGER_PROVIDER);
this._proxyLoggerProvider.setDelegate(provider);
return provider;
}
/**
* Returns the global logger provider.
*
* @returns LoggerProvider
*/
getLoggerProvider() {
var _a, _b;
return ((_b = (_a = _global[GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(_global, API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider);
}
/**
* Returns a logger from the global logger provider.
*
* @returns Logger
*/
getLogger(name, version, options) {
return this.getLoggerProvider().getLogger(name, version, options);
}
/** Remove the global logger provider */
disable() {
delete _global[GLOBAL_LOGS_API_KEY];
this._proxyLoggerProvider = new ProxyLoggerProvider();
}
}
//# sourceMappingURL=logs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/api/logs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mCAAmC,EACnC,mBAAmB,EACnB,OAAO,EACP,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,OAAO,OAAO;IAKlB;QAFQ,yBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAElC,CAAC;IAEjB,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,uBAAuB,CAAC,QAAwB;QACrD,IAAI,OAAO,CAAC,mBAAmB,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;SACjC;QAED,OAAO,CAAC,mBAAmB,CAAC,GAAG,UAAU,CACvC,mCAAmC,EACnC,QAAQ,EACR,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACI,iBAAiB;;QACtB,OAAO,CACL,MAAA,MAAA,OAAO,CAAC,mBAAmB,CAAC,+CAA5B,OAAO,EAAwB,mCAAmC,CAAC,mCACnE,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,SAAS,CACd,IAAY,EACZ,OAAgB,EAChB,OAAuB;QAEvB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,wCAAwC;IACjC,OAAO;QACZ,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpC,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n API_BACKWARDS_COMPATIBILITY_VERSION,\n GLOBAL_LOGS_API_KEY,\n _global,\n makeGetter,\n} from '../internal/global-utils';\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';\nimport { Logger } from '../types/Logger';\nimport { LoggerOptions } from '../types/LoggerOptions';\nimport { ProxyLoggerProvider } from '../ProxyLoggerProvider';\n\nexport class LogsAPI {\n private static _instance?: LogsAPI;\n\n private _proxyLoggerProvider = new ProxyLoggerProvider();\n\n private constructor() {}\n\n public static getInstance(): LogsAPI {\n if (!this._instance) {\n this._instance = new LogsAPI();\n }\n\n return this._instance;\n }\n\n public setGlobalLoggerProvider(provider: LoggerProvider): LoggerProvider {\n if (_global[GLOBAL_LOGS_API_KEY]) {\n return this.getLoggerProvider();\n }\n\n _global[GLOBAL_LOGS_API_KEY] = makeGetter<LoggerProvider>(\n API_BACKWARDS_COMPATIBILITY_VERSION,\n provider,\n NOOP_LOGGER_PROVIDER\n );\n this._proxyLoggerProvider.setDelegate(provider);\n\n return provider;\n }\n\n /**\n * Returns the global logger provider.\n *\n * @returns LoggerProvider\n */\n public getLoggerProvider(): LoggerProvider {\n return (\n _global[GLOBAL_LOGS_API_KEY]?.(API_BACKWARDS_COMPATIBILITY_VERSION) ??\n this._proxyLoggerProvider\n );\n }\n\n /**\n * Returns a logger from the global logger provider.\n *\n * @returns Logger\n */\n public getLogger(\n name: string,\n version?: string,\n options?: LoggerOptions\n ): Logger {\n return this.getLoggerProvider().getLogger(name, version, options);\n }\n\n /** Remove the global logger provider */\n public disable(): void {\n delete _global[GLOBAL_LOGS_API_KEY];\n this._proxyLoggerProvider = new ProxyLoggerProvider();\n }\n}\n"]}

View File

@@ -0,0 +1,12 @@
export { Logger } from './types/Logger';
export { LoggerProvider } from './types/LoggerProvider';
export { LogAttributes, LogBody, LogRecord, SeverityNumber, } from './types/LogRecord';
export { LoggerOptions } from './types/LoggerOptions';
export { AnyValue, AnyValueMap } from './types/AnyValue';
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
export { ProxyLogger } from './ProxyLogger';
export { ProxyLoggerProvider } from './ProxyLoggerProvider';
import { LogsAPI } from './api/logs';
export declare const logs: LogsAPI;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { SeverityNumber, } from './types/LogRecord';
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
export { ProxyLogger } from './ProxyLogger';
export { ProxyLoggerProvider } from './ProxyLoggerProvider';
import { LogsAPI } from './api/logs';
export const logs = LogsAPI.getInstance();
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAIL,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { Logger } from './types/Logger';\nexport { LoggerProvider } from './types/LoggerProvider';\nexport {\n LogAttributes,\n LogBody,\n LogRecord,\n SeverityNumber,\n} from './types/LogRecord';\nexport { LoggerOptions } from './types/LoggerOptions';\nexport { AnyValue, AnyValueMap } from './types/AnyValue';\nexport { NOOP_LOGGER, NoopLogger } from './NoopLogger';\nexport { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';\nexport { ProxyLogger } from './ProxyLogger';\nexport { ProxyLoggerProvider } from './ProxyLoggerProvider';\n\nimport { LogsAPI } from './api/logs';\nexport const logs = LogsAPI.getInstance();\n"]}

View File

@@ -0,0 +1,25 @@
import { LoggerProvider } from '../types/LoggerProvider';
export declare const GLOBAL_LOGS_API_KEY: unique symbol;
declare type Get<T> = (version: number) => T;
export declare const _global: Partial<{
[GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;
}>;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
export declare function makeGetter<T>(requiredVersion: number, instance: T, fallback: T): Get<T>;
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
export declare const API_BACKWARDS_COMPATIBILITY_VERSION = 1;
export {};
//# sourceMappingURL=global-utils.d.ts.map

View File

@@ -0,0 +1,38 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { _globalThis } from '../platform';
export const GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');
export const _global = _globalThis;
/**
* Make a function which accepts a version integer and returns the instance of an API if the version
* is compatible, or a fallback version (usually NOOP) if it is not.
*
* @param requiredVersion Backwards compatibility version which is required to return the instance
* @param instance Instance which should be returned if the required version is compatible
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
*/
export function makeGetter(requiredVersion, instance, fallback) {
return (version) => version === requiredVersion ? instance : fallback;
}
/**
* A number which should be incremented each time a backwards incompatible
* change is made to the API. This number is used when an API package
* attempts to access the global API to ensure it is getting a compatible
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
export const API_BACKWARDS_COMPATIBILITY_VERSION = 1;
//# sourceMappingURL=global-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAO9E,MAAM,CAAC,MAAM,OAAO,GAAG,WAAyB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,eAAuB,EACvB,QAAW,EACX,QAAW;IAEX,OAAO,CAAC,OAAe,EAAK,EAAE,CAC5B,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerProvider } from '../types/LoggerProvider';\nimport { _globalThis } from '../platform';\n\nexport const GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');\n\ntype Get<T> = (version: number) => T;\ntype OtelGlobal = Partial<{\n [GLOBAL_LOGS_API_KEY]: Get<LoggerProvider>;\n}>;\n\nexport const _global = _globalThis as OtelGlobal;\n\n/**\n * Make a function which accepts a version integer and returns the instance of an API if the version\n * is compatible, or a fallback version (usually NOOP) if it is not.\n *\n * @param requiredVersion Backwards compatibility version which is required to return the instance\n * @param instance Instance which should be returned if the required version is compatible\n * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible\n */\nexport function makeGetter<T>(\n requiredVersion: number,\n instance: T,\n fallback: T\n): Get<T> {\n return (version: number): T =>\n version === requiredVersion ? instance : fallback;\n}\n\n/**\n * A number which should be incremented each time a backwards incompatible\n * change is made to the API. This number is used when an API package\n * attempts to access the global API to ensure it is getting a compatible\n * version. If the global API is not compatible with the API package\n * attempting to get it, a NOOP API implementation will be returned.\n */\nexport const API_BACKWARDS_COMPATIBILITY_VERSION = 1;\n"]}

View File

@@ -0,0 +1,10 @@
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,36 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Updates to this file should also be replicated to @opentelemetry/api and
// @opentelemetry/core too.
/**
* - globalThis (New standard)
* - self (Will return the current window instance for supported browsers)
* - window (fallback for older browser implementations)
* - global (NodeJS implementation)
* - <object> (When all else fails)
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
export const _globalThis = typeof globalThis === 'object'
? globalThis
: typeof self === 'object'
? self
: typeof window === 'object'
? window
: typeof global === 'object'
? global
: {};
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2EAA2E;AAC3E,2BAA2B;AAE3B;;;;;;GAMG;AAEH,gEAAgE;AAChE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GACtB,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAE,EAAwB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Updates to this file should also be replicated to @opentelemetry/api and\n// @opentelemetry/core too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './node';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './node';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './node';\n"]}

View File

@@ -0,0 +1,3 @@
/** only globals that common to node and browsers are allowed */
export declare const _globalThis: typeof globalThis;
//# sourceMappingURL=globalThis.d.ts.map

View File

@@ -0,0 +1,19 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** only globals that common to node and browsers are allowed */
// eslint-disable-next-line node/no-unsupported-features/es-builtins
export const _globalThis = typeof globalThis === 'object' ? globalThis : global;
//# sourceMappingURL=globalThis.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/node/globalThis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gEAAgE;AAChE,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins\nexport const _globalThis = typeof globalThis === 'object' ? globalThis : global;\n"]}

View File

@@ -0,0 +1,2 @@
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { _globalThis } from './globalThis';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { _globalThis } from './globalThis';\n"]}

View File

@@ -0,0 +1,18 @@
export declare type AnyValueScalar = string | number | boolean;
export declare type AnyValueArray = Array<AnyValue>;
/**
* AnyValueMap is a map from string to AnyValue (attribute value or a nested map)
*/
export interface AnyValueMap {
[attributeKey: string]: AnyValue;
}
/**
* AnyValue can be one of the following:
* - a scalar value
* - a byte array
* - array of any value
* - map from string to any value
* - empty value
*/
export declare type AnyValue = AnyValueScalar | Uint8Array | AnyValueArray | AnyValueMap | null | undefined;
//# sourceMappingURL=AnyValue.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};
//# sourceMappingURL=AnyValue.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AnyValue.js","sourceRoot":"","sources":["../../../src/types/AnyValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type AnyValueScalar = string | number | boolean;\n\nexport type AnyValueArray = Array<AnyValue>;\n\n/**\n * AnyValueMap is a map from string to AnyValue (attribute value or a nested map)\n */\nexport interface AnyValueMap {\n [attributeKey: string]: AnyValue;\n}\n\n/**\n * AnyValue can be one of the following:\n * - a scalar value\n * - a byte array\n * - array of any value\n * - map from string to any value\n * - empty value\n */\nexport type AnyValue =\n | AnyValueScalar\n | Uint8Array\n | AnyValueArray\n | AnyValueMap\n | null\n | undefined;\n"]}

View File

@@ -0,0 +1,62 @@
import { Context, TimeInput } from '@opentelemetry/api';
import { AnyValue, AnyValueMap } from './AnyValue';
export declare type LogBody = AnyValue;
export declare type LogAttributes = AnyValueMap;
export declare enum SeverityNumber {
UNSPECIFIED = 0,
TRACE = 1,
TRACE2 = 2,
TRACE3 = 3,
TRACE4 = 4,
DEBUG = 5,
DEBUG2 = 6,
DEBUG3 = 7,
DEBUG4 = 8,
INFO = 9,
INFO2 = 10,
INFO3 = 11,
INFO4 = 12,
WARN = 13,
WARN2 = 14,
WARN3 = 15,
WARN4 = 16,
ERROR = 17,
ERROR2 = 18,
ERROR3 = 19,
ERROR4 = 20,
FATAL = 21,
FATAL2 = 22,
FATAL3 = 23,
FATAL4 = 24
}
export interface LogRecord {
/**
* The time when the log record occurred as UNIX Epoch time in nanoseconds.
*/
timestamp?: TimeInput;
/**
* Time when the event was observed by the collection system.
*/
observedTimestamp?: TimeInput;
/**
* Numerical value of the severity.
*/
severityNumber?: SeverityNumber;
/**
* The severity text.
*/
severityText?: string;
/**
* A value containing the body of the log record.
*/
body?: LogBody;
/**
* Attributes that define the log record.
*/
attributes?: LogAttributes;
/**
* The Context associated with the LogRecord.
*/
context?: Context;
}
//# sourceMappingURL=LogRecord.d.ts.map

View File

@@ -0,0 +1,44 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export var SeverityNumber;
(function (SeverityNumber) {
SeverityNumber[SeverityNumber["UNSPECIFIED"] = 0] = "UNSPECIFIED";
SeverityNumber[SeverityNumber["TRACE"] = 1] = "TRACE";
SeverityNumber[SeverityNumber["TRACE2"] = 2] = "TRACE2";
SeverityNumber[SeverityNumber["TRACE3"] = 3] = "TRACE3";
SeverityNumber[SeverityNumber["TRACE4"] = 4] = "TRACE4";
SeverityNumber[SeverityNumber["DEBUG"] = 5] = "DEBUG";
SeverityNumber[SeverityNumber["DEBUG2"] = 6] = "DEBUG2";
SeverityNumber[SeverityNumber["DEBUG3"] = 7] = "DEBUG3";
SeverityNumber[SeverityNumber["DEBUG4"] = 8] = "DEBUG4";
SeverityNumber[SeverityNumber["INFO"] = 9] = "INFO";
SeverityNumber[SeverityNumber["INFO2"] = 10] = "INFO2";
SeverityNumber[SeverityNumber["INFO3"] = 11] = "INFO3";
SeverityNumber[SeverityNumber["INFO4"] = 12] = "INFO4";
SeverityNumber[SeverityNumber["WARN"] = 13] = "WARN";
SeverityNumber[SeverityNumber["WARN2"] = 14] = "WARN2";
SeverityNumber[SeverityNumber["WARN3"] = 15] = "WARN3";
SeverityNumber[SeverityNumber["WARN4"] = 16] = "WARN4";
SeverityNumber[SeverityNumber["ERROR"] = 17] = "ERROR";
SeverityNumber[SeverityNumber["ERROR2"] = 18] = "ERROR2";
SeverityNumber[SeverityNumber["ERROR3"] = 19] = "ERROR3";
SeverityNumber[SeverityNumber["ERROR4"] = 20] = "ERROR4";
SeverityNumber[SeverityNumber["FATAL"] = 21] = "FATAL";
SeverityNumber[SeverityNumber["FATAL2"] = 22] = "FATAL2";
SeverityNumber[SeverityNumber["FATAL3"] = 23] = "FATAL3";
SeverityNumber[SeverityNumber["FATAL4"] = 24] = "FATAL4";
})(SeverityNumber || (SeverityNumber = {}));
//# sourceMappingURL=LogRecord.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LogRecord.js","sourceRoot":"","sources":["../../../src/types/LogRecord.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,MAAM,CAAN,IAAY,cA0BX;AA1BD,WAAY,cAAc;IACxB,iEAAe,CAAA;IACf,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,qDAAS,CAAA;IACT,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,oDAAS,CAAA;IACT,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,sDAAU,CAAA;IACV,wDAAW,CAAA;IACX,wDAAW,CAAA;IACX,wDAAW,CAAA;AACb,CAAC,EA1BW,cAAc,KAAd,cAAc,QA0BzB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context, TimeInput } from '@opentelemetry/api';\nimport { AnyValue, AnyValueMap } from './AnyValue';\n\nexport type LogBody = AnyValue;\nexport type LogAttributes = AnyValueMap;\n\nexport enum SeverityNumber {\n UNSPECIFIED = 0,\n TRACE = 1,\n TRACE2 = 2,\n TRACE3 = 3,\n TRACE4 = 4,\n DEBUG = 5,\n DEBUG2 = 6,\n DEBUG3 = 7,\n DEBUG4 = 8,\n INFO = 9,\n INFO2 = 10,\n INFO3 = 11,\n INFO4 = 12,\n WARN = 13,\n WARN2 = 14,\n WARN3 = 15,\n WARN4 = 16,\n ERROR = 17,\n ERROR2 = 18,\n ERROR3 = 19,\n ERROR4 = 20,\n FATAL = 21,\n FATAL2 = 22,\n FATAL3 = 23,\n FATAL4 = 24,\n}\n\nexport interface LogRecord {\n /**\n * The time when the log record occurred as UNIX Epoch time in nanoseconds.\n */\n timestamp?: TimeInput;\n\n /**\n * Time when the event was observed by the collection system.\n */\n observedTimestamp?: TimeInput;\n\n /**\n * Numerical value of the severity.\n */\n severityNumber?: SeverityNumber;\n\n /**\n * The severity text.\n */\n severityText?: string;\n\n /**\n * A value containing the body of the log record.\n */\n body?: LogBody;\n\n /**\n * Attributes that define the log record.\n */\n attributes?: LogAttributes;\n\n /**\n * The Context associated with the LogRecord.\n */\n context?: Context;\n}\n"]}

View File

@@ -0,0 +1,10 @@
import { LogRecord } from './LogRecord';
export interface Logger {
/**
* Emit a log record. This method should only be used by log appenders.
*
* @param logRecord
*/
emit(logRecord: LogRecord): void;
}
//# sourceMappingURL=Logger.d.ts.map

View File

@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};
//# sourceMappingURL=Logger.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/types/Logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LogRecord } from './LogRecord';\n\nexport interface Logger {\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord: LogRecord): void;\n}\n"]}

View File

@@ -0,0 +1,18 @@
import { Attributes } from '@opentelemetry/api';
export interface LoggerOptions {
/**
* The schemaUrl of the tracer or instrumentation library
* @default ''
*/
schemaUrl?: string;
/**
* The instrumentation scope attributes to associate with emitted telemetry
*/
scopeAttributes?: Attributes;
/**
* Specifies whether the Trace Context should automatically be passed on to the LogRecords emitted by the Logger.
* @default true
*/
includeTraceContext?: boolean;
}
//# sourceMappingURL=LoggerOptions.d.ts.map

Some files were not shown because too many files have changed in this diff Show More