external_project: Write output in log files when not verbose
diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py
index 1604e25..e2205e5 100644
--- a/mesonbuild/modules/unstable_external_project.py
+++ b/mesonbuild/modules/unstable_external_project.py
@@ -162,12 +162,17 @@
 
     def _run(self, step: str, command: T.List[str]):
         mlog.log('External project {}:'.format(self.name), mlog.bold(step))
-        output = None if self.verbose else subprocess.DEVNULL
+        log_filename = Path(mlog.log_dir, '{}-{}.log'.format(self.name, step))
+        output = None
+        if not self.verbose:
+            output = open(log_filename, 'w')
         p, o, e = Popen_safe(command, cwd=str(self.build_dir), env=self.run_env,
                                       stderr=subprocess.STDOUT,
                                       stdout=output)
         if p.returncode != 0:
-            m = '{} step failed:\n{}'.format(step, e)
+            m = '{} step returned error code {}.'.format(step, p.returncode)
+            if not self.verbose:
+                m += '\nSee logs: ' + str(log_filename)
             raise MesonException(m)
 
     def _create_targets(self):