Documentation ¶
Index ¶
- Constants
- Variables
- func CheckName(name string) error
- func ExtractName(name string) string
- func GetDirPrivileged(name string) (string, error)
- func GetDirUnprivileged(name string) (string, error)
- func ProcName(name string, username string) string
- func SetLogFile(name string, uid int) (*os.File, *os.File, error)
- type File
- type LogFormatter
- type Logger
Constants ¶
const ( // DefaultLogFormat represents default log format. DefaultLogFormat = "default" // KubernetesLogFormat represents kubernetes log format. KubernetesLogFormat = "kubernetes" // JSONLogFormat represents JSON log format. JSONLogFormat = "json" )
Variables ¶
var LogFormats = map[string]LogFormatter{ DefaultLogFormat: defaultLogFormatter, KubernetesLogFormat: kubernetesLogFormatter, JSONLogFormat: jsonLogFormatter, }
LogFormats contains supported log format by default.
Functions ¶
func ExtractName ¶
ExtractName extracts instance name from an instance:// URI
func GetDirPrivileged ¶
GetDirPrivileged returns directory where instances file will be stored if instance is run with privileges
func GetDirUnprivileged ¶
GetDirUnprivileged returns directory where instances file will be stored if instance is run without privileges
Types ¶
type File ¶
type File struct { Path string `json:"-"` Pid int `json:"pid"` PPid int `json:"ppid"` Name string `json:"name"` User string `json:"user"` Image string `json:"image"` Privileged bool `json:"privileged"` Config []byte `json:"config"` }
File represents an instance file storing instance information
func (*File) MountNamespaces ¶
MountNamespaces binds /proc/<pid>/ns directory into instance folder
func (*File) PrivilegedPath ¶
PrivilegedPath returns if instance file is stored in privileged path or not
func (*File) UpdateNamespacesPath ¶
func (i *File) UpdateNamespacesPath(configNs []specs.LinuxNamespace) error
UpdateNamespacesPath updates namespaces path for the provided configuration
type LogFormatter ¶
LogFormatter implements a log formatter.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger defines a file logger.
func NewLogger ¶
func NewLogger(logPath string, formatter LogFormatter) (*Logger, error)
NewLogger instantiates a new logger with formatter and return it.
func (*Logger) NewWriter ¶
func (l *Logger) NewWriter(stream string, dropCRNL bool) *io.PipeWriter
NewWriter create a new pipe pair for corresponding stream.
func (*Logger) ReOpenFile ¶
func (l *Logger) ReOpenFile()
ReOpenFile closes and re-open log file (eg: log rotation).