forked from openfresh/wse-rest-library-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.go
42 lines (32 loc) · 1.27 KB
/
logging.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package wserest
import (
"strconv"
"github.com/sebastien4/wse-rest-library-go/entity/application/helper"
"github.com/sebastien4/wse-rest-library-go/entity/base"
)
// Logging is log file utility
type Logging struct {
wowza
}
// NewLogging creates Logging object
func NewLogging(settings *helper.Settings) *Logging {
l := new(Logging)
l.init(settings)
l.baseURI = l.host() + "/servers/" + l.serverInstance() + "/logfiles"
return l
}
// GetNewestFirst retrieves the list of server log files
func (l *Logging) GetNewestFirst() (map[string]interface{}, error) {
l.setRestURI(l.baseURI + "?order=newestFirst")
return l.sendRequest(l.preparePropertiesForRequest(), []base.Entity{}, GET, "")
}
// GetLineCount retrieves the contents of a Server Log
func (l *Logging) GetLineCount(num int) (map[string]interface{}, error) {
l.setRestURI(l.baseURI + "/wowzastreamingengine_access.log?lineCount=" + strconv.Itoa(num))
return l.sendRequest(l.preparePropertiesForRequest(), []base.Entity{}, GET, "")
}
// Search retrieves the contents of a Server Log containing str
func (l *Logging) Search(str string) (map[string]interface{}, error) {
l.setRestURI(l.baseURI + "/wowzastreamingengine_access.log?search=" + str)
return l.sendRequest(l.preparePropertiesForRequest(), []base.Entity{}, GET, "")
}