@@ -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.
1620type 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.
4324func 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 .
9277func 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
9788var log logger
9889
0 commit comments