1414 * limitations under the License.
1515 */
1616
17- import { AttributeValue , diag } from '@opentelemetry/api' ;
1817import type * as logsAPI from '@opentelemetry/api-logs' ;
1918import * as api from '@opentelemetry/api' ;
2019import {
@@ -26,7 +25,6 @@ import type { Resource } from '@opentelemetry/resources';
2625
2726import type { ReadableLogRecord } from './export/ReadableLogRecord' ;
2827import type { LogRecordLimits } from './types' ;
29- import { AnyValue , LogAttributes , LogBody } from '@opentelemetry/api-logs' ;
3028import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState' ;
3129
3230export class LogRecordImpl implements ReadableLogRecord {
@@ -38,7 +36,7 @@ export class LogRecordImpl implements ReadableLogRecord {
3836 readonly attributes : logsAPI . LogAttributes = { } ;
3937 private _severityText ?: string ;
4038 private _severityNumber ?: logsAPI . SeverityNumber ;
41- private _body ?: LogBody ;
39+ private _body ?: logsAPI . LogBody ;
4240 private _eventName ?: string ;
4341 private totalAttributesCount : number = 0 ;
4442
@@ -65,13 +63,13 @@ export class LogRecordImpl implements ReadableLogRecord {
6563 return this . _severityNumber ;
6664 }
6765
68- set body ( body : LogBody | undefined ) {
66+ set body ( body : logsAPI . LogBody | undefined ) {
6967 if ( this . _isLogRecordReadonly ( ) ) {
7068 return ;
7169 }
7270 this . _body = body ;
7371 }
74- get body ( ) : LogBody | undefined {
72+ get body ( ) : logsAPI . LogBody | undefined {
7573 return this . _body ;
7674 }
7775
@@ -125,7 +123,7 @@ export class LogRecordImpl implements ReadableLogRecord {
125123 this . setAttributes ( attributes ) ;
126124 }
127125
128- public setAttribute ( key : string , value ?: AnyValue ) {
126+ public setAttribute ( key : string , value ?: logsAPI . AnyValue ) {
129127 if ( this . _isLogRecordReadonly ( ) ) {
130128 return this ;
131129 }
@@ -167,14 +165,14 @@ export class LogRecordImpl implements ReadableLogRecord {
167165 return this ;
168166 }
169167
170- public setAttributes ( attributes : LogAttributes ) {
168+ public setAttributes ( attributes : logsAPI . LogAttributes ) {
171169 for ( const [ k , v ] of Object . entries ( attributes ) ) {
172170 this . setAttribute ( k , v ) ;
173171 }
174172 return this ;
175173 }
176174
177- public setBody ( body : LogBody ) {
175+ public setBody ( body : logsAPI . LogBody ) {
178176 this . body = body ;
179177 return this ;
180178 }
@@ -203,7 +201,7 @@ export class LogRecordImpl implements ReadableLogRecord {
203201 this . _isReadonly = true ;
204202 }
205203
206- private _truncateToSize ( value : AttributeValue ) : AttributeValue {
204+ private _truncateToSize ( value : api . AttributeValue ) : api . AttributeValue {
207205 const limit = this . _logRecordLimits . attributeValueLengthLimit ;
208206 // Check limit
209207 if ( limit <= 0 ) {
@@ -237,7 +235,7 @@ export class LogRecordImpl implements ReadableLogRecord {
237235
238236 private _isLogRecordReadonly ( ) : boolean {
239237 if ( this . _isReadonly ) {
240- diag . warn ( 'Can not execute the operation on emitted log record' ) ;
238+ api . diag . warn ( 'Can not execute the operation on emitted log record' ) ;
241239 }
242240 return this . _isReadonly ;
243241 }
0 commit comments