The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6067

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This is in preparation for the upcoming storage cleanup.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 8c6748704f29c33dba9b697ddd68ce0214510c0c Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Thu, 2 May 2019 14:46:17 +0200
Subject: [PATCH] lxd: Add pretty logging function

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 lxd/logging.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lxd/logging.go b/lxd/logging.go
index 15b8ccf1f3..62e163cc0d 100644
--- a/lxd/logging.go
+++ b/lxd/logging.go
@@ -147,3 +147,19 @@ func expireLogs(ctx context.Context, state *state.State) 
error {
 
        return nil
 }
+
+func logAction(infoMsg, successMsg, errorMsg string, ctx *log.Ctx, success 
*bool, err *error) func() {
+       logger.Info(infoMsg, *ctx)
+
+       return func() {
+               if *success {
+                       logger.Info(successMsg, *ctx)
+               } else {
+                       if (*err) != nil {
+                               (*ctx)["error"] = (*err).Error()
+                       }
+
+                       logger.Error(errorMsg, *ctx)
+               }
+       }
+}
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to