Records the run logs of the shell program
Signed-off-by: Liu Yinsi liuyinsi@163.com --- lib/log.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/log.sh
diff --git a/lib/log.sh b/lib/log.sh new file mode 100644 index 0000000..626a6e4 --- /dev/null +++ b/lib/log.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +log_info() +{ + date +"[INFO] %F %T ${0##*/}: $*" +} + +log_debug() +{ + date +"[DEBUG] %F %T ${0##*/}: $*" +} + +log_warn() +{ + date +"[WARN] %F %T ${0##*/}: $*" >&2 +} + +log_error() +{ + date +"[ERROR] %F %T ${0##*/}: $*" >&2 +}
On Thu, Jan 28, 2021 at 06:31:45PM +0800, Liu Yinsi wrote:
Records the run logs of the shell program
Signed-off-by: Liu Yinsi liuyinsi@163.com
lib/log.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/log.sh
diff --git a/lib/log.sh b/lib/log.sh new file mode 100644 index 0000000..626a6e4 --- /dev/null +++ b/lib/log.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
can add log() {
}
the same as log_info
like LKP_SRC/lib/log.sh
Thanks, Shenwei
+log_info() +{
- date +"[INFO] %F %T ${0##*/}: $*"
+}
+log_debug() +{
- date +"[DEBUG] %F %T ${0##*/}: $*"
+}
+log_warn() +{
- date +"[WARN] %F %T ${0##*/}: $*" >&2
+}
+log_error() +{
- date +"[ERROR] %F %T ${0##*/}: $*" >&2
+}
2.23.0
On Thu, Jan 28, 2021 at 07:37:45PM +0800, Xiao Shenwei wrote:
On Thu, Jan 28, 2021 at 06:31:45PM +0800, Liu Yinsi wrote:
Records the run logs of the shell program
Signed-off-by: Liu Yinsi liuyinsi@163.com
lib/log.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/log.sh
diff --git a/lib/log.sh b/lib/log.sh new file mode 100644 index 0000000..626a6e4 --- /dev/null +++ b/lib/log.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
can add log() {
}
the same as log_info
like LKP_SRC/lib/log.sh
uncessary
Thanks, Yinsi
Thanks, Shenwei
+log_info() +{
- date +"[INFO] %F %T ${0##*/}: $*"
+}
+log_debug() +{
- date +"[DEBUG] %F %T ${0##*/}: $*"
+}
+log_warn() +{
- date +"[WARN] %F %T ${0##*/}: $*" >&2
+}
+log_error() +{
- date +"[ERROR] %F %T ${0##*/}: $*" >&2
+}
2.23.0
@@ -0,0 +1,23 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+log_info() +{
- date +"[INFO] %F %T ${0##*/}: $*"
+}
+log_debug() +{
- date +"[DEBUG] %F %T ${0##*/}: $*"
+}
+log_warn() +{
- date +"[WARN] %F %T ${0##*/}: $*" >&2
+}
+log_error() +{
- date +"[ERROR] %F %T ${0##*/}: $*" >&2
keep same indentation for for the time part: date +"[INFO] %F %T ${0##*/}: $*" date +"[DEBUG] %F %T ${0##*/}: $*" date +"[WARN] %F %T ${0##*/}: $*" >&2 date +"[ERROR] %F %T ${0##*/}: $*" >&2
Thanks, Luan Shengde
+}
2.23.0
On Fri, Jan 29, 2021 at 09:48:11AM +0800, Luan Shengde wrote:
@@ -0,0 +1,23 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
keep same indentation for for the time part:
unnecessary
Thanks, Yinsi
date +"[INFO] %F %T ${0##*/}: $*" date +"[DEBUG] %F %T ${0##*/}: $*" date +"[WARN] %F %T ${0##*/}: $*" >&2 date +"[ERROR] %F %T ${0##*/}: $*" >&2
Thanks, Luan Shengde
+}
2.23.0