@@ -74,28 +74,40 @@ func NewService(config Config) (*common.HTTPHandler, error) {
74
74
75
75
// StartCPUProfiler starts a cpu profile writing to the specified file
76
76
func (a * Admin ) StartCPUProfiler (_ * http.Request , _ * struct {}, _ * api.EmptyReply ) error {
77
- a .Log .Debug ("Admin: StartCPUProfiler called" )
77
+ a .Log .Debug ("API called" ,
78
+ zap .String ("service" , "admin" ),
79
+ zap .String ("method" , "startCPUProfiler" ),
80
+ )
78
81
79
82
return a .profiler .StartCPUProfiler ()
80
83
}
81
84
82
85
// StopCPUProfiler stops the cpu profile
83
86
func (a * Admin ) StopCPUProfiler (_ * http.Request , _ * struct {}, _ * api.EmptyReply ) error {
84
- a .Log .Debug ("Admin: StopCPUProfiler called" )
87
+ a .Log .Debug ("API called" ,
88
+ zap .String ("service" , "admin" ),
89
+ zap .String ("method" , "stopCPUProfiler" ),
90
+ )
85
91
86
92
return a .profiler .StopCPUProfiler ()
87
93
}
88
94
89
95
// MemoryProfile runs a memory profile writing to the specified file
90
96
func (a * Admin ) MemoryProfile (_ * http.Request , _ * struct {}, _ * api.EmptyReply ) error {
91
- a .Log .Debug ("Admin: MemoryProfile called" )
97
+ a .Log .Debug ("API called" ,
98
+ zap .String ("service" , "admin" ),
99
+ zap .String ("method" , "memoryProfile" ),
100
+ )
92
101
93
102
return a .profiler .MemoryProfile ()
94
103
}
95
104
96
105
// LockProfile runs a mutex profile writing to the specified file
97
106
func (a * Admin ) LockProfile (_ * http.Request , _ * struct {}, _ * api.EmptyReply ) error {
98
- a .Log .Debug ("Admin: LockProfile called" )
107
+ a .Log .Debug ("API called" ,
108
+ zap .String ("service" , "admin" ),
109
+ zap .String ("method" , "lockProfile" ),
110
+ )
99
111
100
112
return a .profiler .LockProfile ()
101
113
}
@@ -108,7 +120,9 @@ type AliasArgs struct {
108
120
109
121
// Alias attempts to alias an HTTP endpoint to a new name
110
122
func (a * Admin ) Alias (_ * http.Request , args * AliasArgs , _ * api.EmptyReply ) error {
111
- a .Log .Debug ("Admin: Alias called" ,
123
+ a .Log .Debug ("API called" ,
124
+ zap .String ("service" , "admin" ),
125
+ zap .String ("method" , "alias" ),
112
126
logging .UserString ("endpoint" , args .Endpoint ),
113
127
logging .UserString ("alias" , args .Alias ),
114
128
)
@@ -128,7 +142,9 @@ type AliasChainArgs struct {
128
142
129
143
// AliasChain attempts to alias a chain to a new name
130
144
func (a * Admin ) AliasChain (_ * http.Request , args * AliasChainArgs , _ * api.EmptyReply ) error {
131
- a .Log .Debug ("Admin: AliasChain called" ,
145
+ a .Log .Debug ("API called" ,
146
+ zap .String ("service" , "admin" ),
147
+ zap .String ("method" , "aliasChain" ),
132
148
logging .UserString ("chain" , args .Chain ),
133
149
logging .UserString ("alias" , args .Alias ),
134
150
)
@@ -162,7 +178,9 @@ type GetChainAliasesReply struct {
162
178
163
179
// GetChainAliases returns the aliases of the chain
164
180
func (a * Admin ) GetChainAliases (_ * http.Request , args * GetChainAliasesArgs , reply * GetChainAliasesReply ) error {
165
- a .Log .Debug ("Admin: GetChainAliases called" ,
181
+ a .Log .Debug ("API called" ,
182
+ zap .String ("service" , "admin" ),
183
+ zap .String ("method" , "getChainAliases" ),
166
184
logging .UserString ("chain" , args .Chain ),
167
185
)
168
186
@@ -177,7 +195,10 @@ func (a *Admin) GetChainAliases(_ *http.Request, args *GetChainAliasesArgs, repl
177
195
178
196
// Stacktrace returns the current global stacktrace
179
197
func (a * Admin ) Stacktrace (_ * http.Request , _ * struct {}, _ * api.EmptyReply ) error {
180
- a .Log .Debug ("Admin: Stacktrace called" )
198
+ a .Log .Debug ("API called" ,
199
+ zap .String ("service" , "admin" ),
200
+ zap .String ("method" , "stacktrace" ),
201
+ )
181
202
182
203
stacktrace := []byte (utils .GetStacktrace (true ))
183
204
return perms .WriteFile (stacktraceFile , stacktrace , perms .ReadWrite )
@@ -200,7 +221,9 @@ type SetLoggerLevelArgs struct {
200
221
// If args.DisplayLevel == nil, doesn't set the display level of these loggers.
201
222
// If args.DisplayLevel != nil, must be a valid string representation of a log level.
202
223
func (a * Admin ) SetLoggerLevel (_ * http.Request , args * SetLoggerLevelArgs , _ * api.EmptyReply ) error {
203
- a .Log .Debug ("Admin: SetLoggerLevel called" ,
224
+ a .Log .Debug ("API called" ,
225
+ zap .String ("service" , "admin" ),
226
+ zap .String ("method" , "setLoggerLevel" ),
204
227
logging .UserString ("loggerName" , args .LoggerName ),
205
228
zap .Stringer ("logLevel" , args .LogLevel ),
206
229
zap .Stringer ("displayLevel" , args .DisplayLevel ),
@@ -250,7 +273,9 @@ type GetLoggerLevelReply struct {
250
273
251
274
// GetLogLevel returns the log level and display level of all loggers.
252
275
func (a * Admin ) GetLoggerLevel (_ * http.Request , args * GetLoggerLevelArgs , reply * GetLoggerLevelReply ) error {
253
- a .Log .Debug ("Admin: GetLoggerLevels called" ,
276
+ a .Log .Debug ("API called" ,
277
+ zap .String ("service" , "admin" ),
278
+ zap .String ("method" , "getLoggerLevels" ),
254
279
logging .UserString ("loggerName" , args .LoggerName ),
255
280
)
256
281
reply .LoggerLevels = make (map [string ]LogAndDisplayLevels )
@@ -281,7 +306,10 @@ func (a *Admin) GetLoggerLevel(_ *http.Request, args *GetLoggerLevelArgs, reply
281
306
282
307
// GetConfig returns the config that the node was started with.
283
308
func (a * Admin ) GetConfig (_ * http.Request , _ * struct {}, reply * interface {}) error {
284
- a .Log .Debug ("Admin: GetConfig called" )
309
+ a .Log .Debug ("API called" ,
310
+ zap .String ("service" , "admin" ),
311
+ zap .String ("method" , "getConfig" ),
312
+ )
285
313
* reply = a .NodeConfig
286
314
return nil
287
315
}
@@ -296,7 +324,10 @@ type LoadVMsReply struct {
296
324
297
325
// LoadVMs loads any new VMs available to the node and returns the added VMs.
298
326
func (a * Admin ) LoadVMs (r * http.Request , _ * struct {}, reply * LoadVMsReply ) error {
299
- a .Log .Debug ("Admin: LoadVMs called" )
327
+ a .Log .Debug ("API called" ,
328
+ zap .String ("service" , "admin" ),
329
+ zap .String ("method" , "loadVMs" ),
330
+ )
300
331
301
332
ctx := r .Context ()
302
333
loadedVMs , failedVMs , err := a .VMRegistry .ReloadWithReadLock (ctx )
0 commit comments