Skip to content

Conversation

@Badlazzor
Copy link
Contributor

Singles out [Bitrise ...] logs from the rest and forwards them to stdout

Singles out [Bitrise ...] logs from the rest and forwards them to stdout
@Badlazzor Badlazzor changed the title Add a log interceptor [ACI-4111] Add a log interceptor Sep 2, 2025
@bitrise-ip-bot
Copy link
Contributor

bitrise-ip-bot commented Sep 2, 2025

Summary

This PR adds a log interceptor that filters and routes log output based on regex patterns. It introduces a new PrefixInterceptor that can intercept writes matching a specific prefix pattern and forward them to multiple outputs. The implementation includes proper goroutine management and pipe-based communication for handling concurrent log processing.

Walkthrough

File Summary
loginterceptor/loginterceptor.go, loginterceptor/loginterceptor_test.go Added new log interceptor package with PrefixInterceptor implementation and tests
xcpretty/xcpretty.go Integrated log interceptor to filter [Bitrise...] prefixed logs to stdout

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 2

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 3

Badlazzor and others added 2 commits September 2, 2025 16:41
Co-authored-by: bitrise-ip-bot <95076763+bitrise-ip-bot@users.noreply.github.com>
Co-authored-by: bitrise-ip-bot <95076763+bitrise-ip-bot@users.noreply.github.com>
Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 2

Co-authored-by: bitrise-ip-bot <95076763+bitrise-ip-bot@users.noreply.github.com>
Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 3

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

interceptor := loginterceptor.NewPrefixInterceptor(re, os.Stdout, outWriter)
defer func() {
if err := interceptor.Close(); err != nil {
loggerV1.Warnf("Failed to close log interceptor, error: %s", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're using the go-utils log, can we use the same in the interceptor too?

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

Copy link
Contributor

@bitrise-ip-bot bitrise-ip-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

@Badlazzor Badlazzor merged commit 59044af into master Sep 3, 2025
3 checks passed
@Badlazzor Badlazzor deleted the ACI-4111-add-log-interceptor branch September 3, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants