-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/complex-variables
- Loading branch information
Showing
33 changed files
with
1,157 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package python | ||
|
||
import ( | ||
"bufio" | ||
"bytes" | ||
"context" | ||
"io" | ||
|
||
"github.com/databricks/cli/libs/log" | ||
) | ||
|
||
type logWriter struct { | ||
ctx context.Context | ||
prefix string | ||
buf bytes.Buffer | ||
} | ||
|
||
// newLogWriter creates a new io.Writer that writes to log with specified prefix. | ||
func newLogWriter(ctx context.Context, prefix string) io.Writer { | ||
return &logWriter{ | ||
ctx: ctx, | ||
prefix: prefix, | ||
} | ||
} | ||
|
||
func (p *logWriter) Write(bytes []byte) (n int, err error) { | ||
p.buf.Write(bytes) | ||
|
||
scanner := bufio.NewScanner(&p.buf) | ||
|
||
for scanner.Scan() { | ||
line := scanner.Text() | ||
|
||
log.Debugf(p.ctx, "%s%s", p.prefix, line) | ||
} | ||
|
||
remaining := p.buf.Bytes() | ||
p.buf.Reset() | ||
p.buf.Write(remaining) | ||
|
||
return len(bytes), nil | ||
} |
Oops, something went wrong.