mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 00:54:23 +00:00
Rename Process to Instance
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Logger struct {
|
||||
type logger struct {
|
||||
name string
|
||||
logDir string
|
||||
logFile *os.File
|
||||
@@ -18,15 +18,15 @@ type Logger struct {
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
func NewInstanceLogger(name string, logDir string) *Logger {
|
||||
return &Logger{
|
||||
func NewLogger(name string, logDir string) *logger {
|
||||
return &logger{
|
||||
name: name,
|
||||
logDir: logDir,
|
||||
}
|
||||
}
|
||||
|
||||
// Create creates and opens the log files for stdout and stderr
|
||||
func (i *Logger) Create() error {
|
||||
func (i *logger) Create() error {
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
|
||||
@@ -57,7 +57,7 @@ func (i *Logger) Create() error {
|
||||
}
|
||||
|
||||
// GetLogs retrieves the last n lines of logs from the instance
|
||||
func (i *Logger) GetLogs(num_lines int) (string, error) {
|
||||
func (i *logger) GetLogs(num_lines int) (string, error) {
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
|
||||
@@ -98,7 +98,7 @@ func (i *Logger) GetLogs(num_lines int) (string, error) {
|
||||
}
|
||||
|
||||
// closeLogFile closes the log files
|
||||
func (i *Logger) Close() {
|
||||
func (i *logger) Close() {
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
|
||||
@@ -111,7 +111,7 @@ func (i *Logger) Close() {
|
||||
}
|
||||
|
||||
// readOutput reads from the given reader and writes lines to the log file
|
||||
func (i *Logger) readOutput(reader io.ReadCloser) {
|
||||
func (i *logger) readOutput(reader io.ReadCloser) {
|
||||
defer reader.Close()
|
||||
|
||||
scanner := bufio.NewScanner(reader)
|
||||
|
||||
Reference in New Issue
Block a user