Skip to content

Commit 45fcc0d

Browse files
authored
Removed log constants (Azure#17729)
They should be defined in azcore/log, not here. Added comments indicating which parts of log are public surface area.
1 parent 49adbd2 commit 45fcc0d

File tree

4 files changed

+23
-26
lines changed

4 files changed

+23
-26
lines changed

sdk/internal/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Release History
22

3-
## 0.9.3 (Unreleased)
3+
## 0.10.0 (Unreleased)
44

55
### Features Added
66

77
### Breaking Changes
8+
* Removed logging constants from the `log` package.
89

910
### Bugs Fixed
1011

sdk/internal/log/log.go

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,13 @@ import (
1212
"time"
1313
)
1414

15+
///////////////////////////////////////////////////////////////////////////////////////////////////
16+
// NOTE: The following are exported as public surface area from azcore. DO NOT MODIFY
17+
///////////////////////////////////////////////////////////////////////////////////////////////////
18+
1519
// Event is used to group entries. Each group can be toggled on or off.
1620
type Event string
1721

18-
const (
19-
// EventRequest entries contain information about HTTP requests.
20-
// This includes information like the URL, query parameters, and headers.
21-
EventRequest Event = "Request"
22-
23-
// EventResponse entries containe information about HTTP responses.
24-
// This includes information like the HTTP status code, headers, and request URL.
25-
EventResponse Event = "Response"
26-
27-
// EventRetryPolicy entries contain information specific to the rety policy in use.
28-
EventRetryPolicy Event = "Retry"
29-
30-
// EventLRO entries contian information specific to long-running operations.
31-
// This includes information like polling location, operation state, and sleep intervals.
32-
EventLRO Event = "LongRunningOperation"
33-
)
34-
35-
// logger controls which events to log and writing to the underlying log.
36-
type logger struct {
37-
cls []Event
38-
lst func(Event, string)
39-
}
40-
4122
// SetEvents is used to control which events are written to
4223
// the log. By default all log events are writen.
4324
func SetEvents(cls ...Event) {
@@ -49,6 +30,10 @@ func SetListener(lst func(Event, string)) {
4930
log.lst = lst
5031
}
5132

33+
///////////////////////////////////////////////////////////////////////////////////////////////////
34+
// END PUBLIC SURFACE AREA
35+
///////////////////////////////////////////////////////////////////////////////////////////////////
36+
5237
// Should returns true if the specified log event should be written to the log.
5338
// By default all log events will be logged. Call SetEvents() to limit
5439
// the log events for logging.
@@ -88,11 +73,17 @@ func Writef(cls Event, format string, a ...interface{}) {
8873
log.lst(cls, fmt.Sprintf(format, a...))
8974
}
9075

91-
// TestResetEvents is used for testing purposes only.
76+
// TestResetEvents is used for TESTING PURPOSES ONLY.
9277
func TestResetEvents() {
9378
log.cls = nil
9479
}
9580

81+
// logger controls which events to log and writing to the underlying log.
82+
type logger struct {
83+
cls []Event
84+
lst func(Event, string)
85+
}
86+
9687
// the process-wide logger
9788
var log logger
9889

sdk/internal/log/log_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import (
1010
"testing"
1111
)
1212

13+
const (
14+
EventRequest Event = "Request"
15+
EventResponse Event = "Response"
16+
)
17+
1318
func TestLoggingdefault(t *testing.T) {
1419
// ensure logging with nil listener doesn't fail
1520
SetListener(nil)

sdk/internal/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ const (
1111
Module = "internal"
1212

1313
// Version is the semantic version (see http://semver.org) of this module.
14-
Version = "v0.9.3"
14+
Version = "v0.10.0"
1515
)

0 commit comments

Comments
 (0)