Skip to content

Commit

Permalink
systemd: and method to set the log level
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsosanchezbeato committed May 2, 2024
1 parent 356d7c1 commit abc4be4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions systemd/emulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,7 @@ func (s *emulation) Umount(whatOrWhere string) error {
func (s *emulation) Run(command []string, opts *RunOptions) ([]byte, error) {
return nil, &notImplementedError{"Run"}
}

func (s *emulation) SetLogLevel(logLevel string) error {
return &notImplementedError{"SetLogLevel"}
}
7 changes: 7 additions & 0 deletions systemd/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ type Systemd interface {
CurrentTasksCount(unit string) (uint64, error)
// Run a command
Run(command []string, opts *RunOptions) ([]byte, error)
// Set log level for the system
SetLogLevel(logLevel string) error
}

// KeyringMode describes how the kernel keyring is setup, see systemd.exec(5)
Expand Down Expand Up @@ -1745,3 +1747,8 @@ func (s *systemd) Run(command []string, opts *RunOptions) ([]byte, error) {
}
return stdout, nil
}

func (s *systemd) SetLogLevel(logLevel string) error {
_, err := s.systemctl("log-level", logLevel)
return err
}

0 comments on commit abc4be4

Please sign in to comment.