瀏覽代碼

[downloader] Log final status of all downloads

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 年之前
父節點
當前提交
5a91f5646a
共有 1 個檔案被更改,包括 10 行新增0 行删除
  1. 10
    0
      src/core/downloader.c

+ 10
- 0
src/core/downloader.c 查看文件

@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
21 21
 #include <stdlib.h>
22 22
 #include <stdarg.h>
23 23
 #include <errno.h>
24
+#include <syslog.h>
24 25
 #include <ipxe/iobuf.h>
25 26
 #include <ipxe/xfer.h>
26 27
 #include <ipxe/open.h>
@@ -73,6 +74,15 @@ static void downloader_free ( struct refcnt *refcnt ) {
73 74
  */
74 75
 static void downloader_finished ( struct downloader *downloader, int rc ) {
75 76
 
77
+	/* Log download status */
78
+	if ( rc == 0 ) {
79
+		syslog ( LOG_NOTICE, "Downloaded \"%s\"\n",
80
+			 downloader->image->name );
81
+	} else {
82
+		syslog ( LOG_ERR, "Download of \"%s\" failed: %s\n",
83
+			 downloader->image->name, strerror ( rc ) );
84
+	}
85
+
76 86
 	/* Shut down interfaces */
77 87
 	intf_shutdown ( &downloader->xfer, rc );
78 88
 	intf_shutdown ( &downloader->job, rc );

Loading…
取消
儲存