@@ -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