LoadLogConfig loads the log-config.json for the afferrent container store
(dataStore, ns, id string)
| 161 | |
| 162 | // LoadLogConfig loads the log-config.json for the afferrent container store |
| 163 | func 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 | |
| 179 | func getLockPath(dataStore, ns, id string) string { |
| 180 | return filepath.Join(dataStore, "containers", ns, id, "logger-lock") |
no test coverage detected