Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/amazonq/src/lsp/rotatingLogChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export class RotatingLogChannel implements vscode.LogOutputChannel {
private fileStream: fs.WriteStream | undefined
private originalChannel: vscode.LogOutputChannel
private logger = getLogger('amazonqLsp')
private _logLevel: vscode.LogLevel = vscode.LogLevel.Info
private currentFileSize = 0
// eslint-disable-next-line @typescript-eslint/naming-convention
private readonly MAX_FILE_SIZE = 5 * 1024 * 1024 // 5MB
Expand Down Expand Up @@ -133,7 +132,7 @@ export class RotatingLogChannel implements vscode.LogOutputChannel {
}

get logLevel(): vscode.LogLevel {
return this._logLevel
return this.originalChannel.logLevel
}

get onDidChangeLogLevel(): vscode.Event<vscode.LogLevel> {
Expand Down
28 changes: 28 additions & 0 deletions packages/amazonq/src/test/rotatingLogChannel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,32 @@ describe('RotatingLogChannel', () => {
assert.ok(content.includes('[WARN]'), 'Should include WARN level')
assert.ok(content.includes('[ERROR]'), 'Should include ERROR level')
})

it('delegates log level to the original channel', () => {
// Set up a mock output channel with a specific log level
const mockChannel = {
...mockOutputChannel,
logLevel: vscode.LogLevel.Trace,
}

// Create a new log channel with the mock
const testLogChannel = new RotatingLogChannel('test-delegate', mockExtensionContext, mockChannel)

// Verify that the log level is delegated correctly
assert.strictEqual(
testLogChannel.logLevel,
vscode.LogLevel.Trace,
'Should delegate log level to original channel'
)

// Change the mock's log level
mockChannel.logLevel = vscode.LogLevel.Debug

// Verify that the change is reflected
assert.strictEqual(
testLogChannel.logLevel,
vscode.LogLevel.Debug,
'Should reflect changes to original channel log level'
)
})
})
Loading