Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: log the filename and content of adapter config
Lars Wirzenius committed 10 months ago
commit ccfa86101b10109c92c9ca2f96c1882deaf36bcd
parent d1db5e9
2 files changed +14 -2
modified src/adapter.rs
@@ -120,8 +120,9 @@ impl Adapter {
    fn write_adapter_config(&self, tmpdir: &TempDir) -> Result<PathBuf, AdapterError> {
        let filename = tmpdir.path().join("adapter.yaml");

-
        let json = serde_yml::to_string(self).map_err(AdapterError::AdapterConfigToYaml)?;
-
        std::fs::write(&filename, json.as_bytes()).map_err(AdapterError::AdapterConfigWrite)?;
+
        let yaml = serde_yml::to_string(self).map_err(AdapterError::AdapterConfigToYaml)?;
+
        logger::adapter_temp_config(&filename, &yaml);
+
        std::fs::write(&filename, yaml.as_bytes()).map_err(AdapterError::AdapterConfigWrite)?;

        Ok(filename)
    }
modified src/logger.rs
@@ -114,6 +114,7 @@ enum Id {
    AdapterNoSecondMessage,
    AdapterStderrLine,
    AdapterStdoutLine,
+
    AdapterTempConfig,
    AdapterTooManyMessages,

    BrokerDatabase,
@@ -741,6 +742,16 @@ pub fn patch_cob_lookup(repo_id: &RepoId, patch_id: &PatchId) {
    );
}

+
pub fn adapter_temp_config(filename: &Path, config: &str) {
+
    debug!(
+
        msg_id = ?Id::AdapterTempConfig,
+
        kind = %Kind::AdapterMessage,
+
        ?filename,
+
        ?config,
+
        "adapter config embedded in cib config"
+
    );
+
}
+

pub fn adapter_stdout_line(line: &str) {
    trace!(
        msg_id = ?Id::AdapterStdoutLine,