MCPcopy Index your code
hub / github.com/containerd/nerdctl / LoadLogConfig

Function LoadLogConfig

pkg/logging/logging.go:163–177  ·  view source on GitHub ↗

LoadLogConfig loads the log-config.json for the afferrent container store

(dataStore, ns, id string)

Source from the content-addressed store, hash-verified

161
162// LoadLogConfig loads the log-config.json for the afferrent container store
163func LoadLogConfig(dataStore, ns, id string) (LogConfig, error) {
164 logConfig := LogConfig{}
165
166 logConfigFilePath := LogConfigFilePath(dataStore, ns, id)
167 logConfigData, err := filesystem.ReadFile(logConfigFilePath)
168 if err != nil {
169 return logConfig, fmt.Errorf("failed to read log config file %q: %w", logConfigFilePath, err)
170 }
171
172 err = json.Unmarshal(logConfigData, &logConfig)
173 if err != nil {
174 return logConfig, fmt.Errorf("failed to load JSON logging config file %q: %w", logConfigFilePath, err)
175 }
176 return logConfig, nil
177}
178
179func getLockPath(dataStore, ns, id string) string {
180 return filepath.Join(dataStore, "containers", ns, id, "logger-lock")

Callers 2

loggerFuncFunction · 0.85
InitContainerLogViewerFunction · 0.85

Calls 3

ReadFileFunction · 0.92
LogConfigFilePathFunction · 0.85
UnmarshalMethod · 0.80

Tested by

no test coverage detected