Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib/dracut
File: dracut-logger.sh
#!/bin/bash
[0] Fix | Delete
#
[1] Fix | Delete
# logging faciality module for dracut both at build- and boot-time
[2] Fix | Delete
#
[3] Fix | Delete
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
[4] Fix | Delete
#
[5] Fix | Delete
# This program is free software; you can redistribute it and/or modify
[6] Fix | Delete
# it under the terms of the GNU General Public License as published by
[7] Fix | Delete
# the Free Software Foundation; either version 2 of the License, or
[8] Fix | Delete
# (at your option) any later version.
[9] Fix | Delete
#
[10] Fix | Delete
# This program is distributed in the hope that it will be useful,
[11] Fix | Delete
# but WITHOUT ANY WARRANTY; without even the implied warranty of
[12] Fix | Delete
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[13] Fix | Delete
# GNU General Public License for more details.
[14] Fix | Delete
#
[15] Fix | Delete
# You should have received a copy of the GNU General Public License
[16] Fix | Delete
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[17] Fix | Delete
[18] Fix | Delete
[19] Fix | Delete
__DRACUT_LOGGER__=1
[20] Fix | Delete
[21] Fix | Delete
[22] Fix | Delete
## @brief Logging facility module for dracut both at build- and boot-time.
[23] Fix | Delete
#
[24] Fix | Delete
# @section intro Introduction
[25] Fix | Delete
#
[26] Fix | Delete
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
[27] Fix | Delete
# levels:
[28] Fix | Delete
# - TRACE (6)
[29] Fix | Delete
# The TRACE Level designates finer-grained informational events than the
[30] Fix | Delete
# DEBUG.
[31] Fix | Delete
# - DEBUG (5)
[32] Fix | Delete
# The DEBUG Level designates fine-grained informational events that are most
[33] Fix | Delete
# useful to debug an application.
[34] Fix | Delete
# - INFO (4)
[35] Fix | Delete
# The INFO level designates informational messages that highlight the
[36] Fix | Delete
# progress of the application at coarse-grained level.
[37] Fix | Delete
# - WARN (3)
[38] Fix | Delete
# The WARN level designates potentially harmful situations.
[39] Fix | Delete
# - ERROR (2)
[40] Fix | Delete
# The ERROR level designates error events that might still allow the
[41] Fix | Delete
# application to continue running.
[42] Fix | Delete
# - FATAL (1)
[43] Fix | Delete
# The FATAL level designates very severe error events that will presumably
[44] Fix | Delete
# lead the application to abort.
[45] Fix | Delete
# Descriptions are borrowed from Log4j documentation:
[46] Fix | Delete
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
[47] Fix | Delete
#
[48] Fix | Delete
# @section usage Usage
[49] Fix | Delete
#
[50] Fix | Delete
# First of all you have to start with dlog_init() function which initializes
[51] Fix | Delete
# required variables. Don't call any other logging function before that one!
[52] Fix | Delete
# If you're ready with this, you can use following functions which corresponds
[53] Fix | Delete
# clearly to levels listed in @ref intro Introduction. Here they are:
[54] Fix | Delete
# - dtrace()
[55] Fix | Delete
# - ddebug()
[56] Fix | Delete
# - dinfo()
[57] Fix | Delete
# - dwarn()
[58] Fix | Delete
# - derror()
[59] Fix | Delete
# - dfatal()
[60] Fix | Delete
# They take all arguments given as a single message to be logged. See dlog()
[61] Fix | Delete
# function for details how it works. Note that you shouldn't use dlog() by
[62] Fix | Delete
# yourself. It's wrapped with above functions.
[63] Fix | Delete
#
[64] Fix | Delete
# @see dlog_init() dlog()
[65] Fix | Delete
#
[66] Fix | Delete
# @section conf Configuration
[67] Fix | Delete
#
[68] Fix | Delete
# Logging is controlled by following global variables:
[69] Fix | Delete
# - @var stdloglvl - logging level to standard error (console output)
[70] Fix | Delete
# - @var sysloglvl - logging level to syslog (by logger command)
[71] Fix | Delete
# - @var fileloglvl - logging level to file
[72] Fix | Delete
# - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
[73] Fix | Delete
# - @var logfile - log file which is used when @var fileloglvl is higher
[74] Fix | Delete
# than 0
[75] Fix | Delete
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
[76] Fix | Delete
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
[77] Fix | Delete
# maximum logging level of those three and indicates that dlog_init() was run.
[78] Fix | Delete
# @var syslogfacility is set either to 'user' (when building initramfs) or
[79] Fix | Delete
# 'daemon' (when booting).
[80] Fix | Delete
#
[81] Fix | Delete
# Logging level set by the variable means that messages from this logging level
[82] Fix | Delete
# and above (FATAL is the highest) will be shown. Logging levels may be set
[83] Fix | Delete
# independently for each destination (stderr, syslog, file, kmsg).
[84] Fix | Delete
#
[85] Fix | Delete
# @see dlog_init()
[86] Fix | Delete
[87] Fix | Delete
[88] Fix | Delete
## @brief Initializes dracut Logger.
[89] Fix | Delete
#
[90] Fix | Delete
# @retval 1 if something has gone wrong
[91] Fix | Delete
# @retval 0 on success.
[92] Fix | Delete
#
[93] Fix | Delete
# @note This function need to be called before any other from this file.
[94] Fix | Delete
#
[95] Fix | Delete
# If any of the variables is not set, this function set it to default:
[96] Fix | Delete
# - @var stdloglvl = 4 (info)
[97] Fix | Delete
# - @var sysloglvl = 0 (no logging)
[98] Fix | Delete
# - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
[99] Fix | Delete
# - @var kmsgloglvl = 0 (no logging)
[100] Fix | Delete
# set to 0
[101] Fix | Delete
#
[102] Fix | Delete
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
[103] Fix | Delete
# See file doc comment for details.
[104] Fix | Delete
dlog_init() {
[105] Fix | Delete
local __oldumask
[106] Fix | Delete
local ret=0; local errmsg
[107] Fix | Delete
[ -z "$stdloglvl" ] && stdloglvl=4
[108] Fix | Delete
[ -z "$sysloglvl" ] && sysloglvl=0
[109] Fix | Delete
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
[110] Fix | Delete
# Skip initialization if it's already done.
[111] Fix | Delete
[ -n "$maxloglvl" ] && return 0
[112] Fix | Delete
[113] Fix | Delete
if [ -z "$fileloglvl" ]; then
[114] Fix | Delete
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
[115] Fix | Delete
elif (( $fileloglvl > 0 )); then
[116] Fix | Delete
if [[ $logfile ]]; then
[117] Fix | Delete
__oldumask=$(umask)
[118] Fix | Delete
umask 0377
[119] Fix | Delete
! [ -e "$logfile" ] && >"$logfile"
[120] Fix | Delete
umask $__oldumask
[121] Fix | Delete
if [ -w "$logfile" -a -f "$logfile" ]; then
[122] Fix | Delete
# Mark new run in the log file
[123] Fix | Delete
echo >>"$logfile"
[124] Fix | Delete
if command -v date >/dev/null; then
[125] Fix | Delete
echo "=== $(date) ===" >>"$logfile"
[126] Fix | Delete
else
[127] Fix | Delete
echo "===============================================" >>"$logfile"
[128] Fix | Delete
fi
[129] Fix | Delete
echo >>"$logfile"
[130] Fix | Delete
else
[131] Fix | Delete
# We cannot log to file, so turn this facility off.
[132] Fix | Delete
fileloglvl=0
[133] Fix | Delete
ret=1
[134] Fix | Delete
errmsg="'$logfile' is not a writable file"
[135] Fix | Delete
fi
[136] Fix | Delete
fi
[137] Fix | Delete
fi
[138] Fix | Delete
[139] Fix | Delete
if (( $UID != 0 )); then
[140] Fix | Delete
kmsgloglvl=0
[141] Fix | Delete
sysloglvl=0
[142] Fix | Delete
fi
[143] Fix | Delete
[144] Fix | Delete
if (( $sysloglvl > 0 )); then
[145] Fix | Delete
if [[ -d /run/systemd/journal ]] \
[146] Fix | Delete
&& type -P systemd-cat &>/dev/null \
[147] Fix | Delete
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
[148] Fix | Delete
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
[149] Fix | Delete
readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
[150] Fix | Delete
mkfifo "$_systemdcatfile"
[151] Fix | Delete
readonly _dlogfd=15
[152] Fix | Delete
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
[153] Fix | Delete
exec 15>"$_systemdcatfile"
[154] Fix | Delete
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
[155] Fix | Delete
# We cannot log to syslog, so turn this facility off.
[156] Fix | Delete
kmsgloglvl=$sysloglvl
[157] Fix | Delete
sysloglvl=0
[158] Fix | Delete
ret=1
[159] Fix | Delete
errmsg="No '/dev/log' or 'logger' included for syslog logging"
[160] Fix | Delete
fi
[161] Fix | Delete
fi
[162] Fix | Delete
[163] Fix | Delete
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
[164] Fix | Delete
if [ -n "$dracutbasedir" ]; then
[165] Fix | Delete
readonly syslogfacility=user
[166] Fix | Delete
else
[167] Fix | Delete
readonly syslogfacility=daemon
[168] Fix | Delete
fi
[169] Fix | Delete
export syslogfacility
[170] Fix | Delete
fi
[171] Fix | Delete
[172] Fix | Delete
local lvl; local maxloglvl_l=0
[173] Fix | Delete
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
[174] Fix | Delete
(( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
[175] Fix | Delete
done
[176] Fix | Delete
readonly maxloglvl=$maxloglvl_l
[177] Fix | Delete
export maxloglvl
[178] Fix | Delete
[179] Fix | Delete
[180] Fix | Delete
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
[181] Fix | Delete
unset dtrace
[182] Fix | Delete
dtrace() { :; };
[183] Fix | Delete
fi
[184] Fix | Delete
[185] Fix | Delete
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
[186] Fix | Delete
unset ddebug
[187] Fix | Delete
ddebug() { :; };
[188] Fix | Delete
fi
[189] Fix | Delete
[190] Fix | Delete
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
[191] Fix | Delete
unset dinfo
[192] Fix | Delete
dinfo() { :; };
[193] Fix | Delete
fi
[194] Fix | Delete
[195] Fix | Delete
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
[196] Fix | Delete
unset dwarn
[197] Fix | Delete
dwarn() { :; };
[198] Fix | Delete
unset dwarning
[199] Fix | Delete
dwarning() { :; };
[200] Fix | Delete
fi
[201] Fix | Delete
[202] Fix | Delete
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
[203] Fix | Delete
unset derror
[204] Fix | Delete
derror() { :; };
[205] Fix | Delete
fi
[206] Fix | Delete
[207] Fix | Delete
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
[208] Fix | Delete
unset dfatal
[209] Fix | Delete
dfatal() { :; };
[210] Fix | Delete
fi
[211] Fix | Delete
[212] Fix | Delete
[ -n "$errmsg" ] && derror "$errmsg"
[213] Fix | Delete
[214] Fix | Delete
return $ret
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
## @brief Converts numeric logging level to the first letter of level name.
[218] Fix | Delete
#
[219] Fix | Delete
# @param lvl Numeric logging level in range from 1 to 6.
[220] Fix | Delete
# @retval 1 if @a lvl is out of range.
[221] Fix | Delete
# @retval 0 if @a lvl is correct.
[222] Fix | Delete
# @result Echoes first letter of level name.
[223] Fix | Delete
_lvl2char() {
[224] Fix | Delete
case "$1" in
[225] Fix | Delete
1) echo F;;
[226] Fix | Delete
2) echo E;;
[227] Fix | Delete
3) echo W;;
[228] Fix | Delete
4) echo I;;
[229] Fix | Delete
5) echo D;;
[230] Fix | Delete
6) echo T;;
[231] Fix | Delete
*) return 1;;
[232] Fix | Delete
esac
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
## @brief Converts numeric level to logger priority defined by POSIX.2.
[236] Fix | Delete
#
[237] Fix | Delete
# @param lvl Numeric logging level in range from 1 to 6.
[238] Fix | Delete
# @retval 1 if @a lvl is out of range.
[239] Fix | Delete
# @retval 0 if @a lvl is correct.
[240] Fix | Delete
# @result Echoes logger priority.
[241] Fix | Delete
_lvl2syspri() {
[242] Fix | Delete
printf $syslogfacility.
[243] Fix | Delete
case "$1" in
[244] Fix | Delete
1) echo crit;;
[245] Fix | Delete
2) echo error;;
[246] Fix | Delete
3) echo warning;;
[247] Fix | Delete
4) echo info;;
[248] Fix | Delete
5) echo debug;;
[249] Fix | Delete
6) echo debug;;
[250] Fix | Delete
*) return 1;;
[251] Fix | Delete
esac
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
## @brief Converts dracut-logger numeric level to syslog log level
[255] Fix | Delete
#
[256] Fix | Delete
# @param lvl Numeric logging level in range from 1 to 6.
[257] Fix | Delete
# @retval 1 if @a lvl is out of range.
[258] Fix | Delete
# @retval 0 if @a lvl is correct.
[259] Fix | Delete
# @result Echoes kernel console numeric log level
[260] Fix | Delete
#
[261] Fix | Delete
# Conversion is done as follows:
[262] Fix | Delete
#
[263] Fix | Delete
# <tt>
[264] Fix | Delete
# none -> LOG_EMERG (0)
[265] Fix | Delete
# none -> LOG_ALERT (1)
[266] Fix | Delete
# FATAL(1) -> LOG_CRIT (2)
[267] Fix | Delete
# ERROR(2) -> LOG_ERR (3)
[268] Fix | Delete
# WARN(3) -> LOG_WARNING (4)
[269] Fix | Delete
# none -> LOG_NOTICE (5)
[270] Fix | Delete
# INFO(4) -> LOG_INFO (6)
[271] Fix | Delete
# DEBUG(5) -> LOG_DEBUG (7)
[272] Fix | Delete
# TRACE(6) /
[273] Fix | Delete
# </tt>
[274] Fix | Delete
#
[275] Fix | Delete
# @see /usr/include/sys/syslog.h
[276] Fix | Delete
_dlvl2syslvl() {
[277] Fix | Delete
local lvl
[278] Fix | Delete
[279] Fix | Delete
case "$1" in
[280] Fix | Delete
1) lvl=2;;
[281] Fix | Delete
2) lvl=3;;
[282] Fix | Delete
3) lvl=4;;
[283] Fix | Delete
4) lvl=6;;
[284] Fix | Delete
5) lvl=7;;
[285] Fix | Delete
6) lvl=7;;
[286] Fix | Delete
*) return 1;;
[287] Fix | Delete
esac
[288] Fix | Delete
[289] Fix | Delete
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
[293] Fix | Delete
# given message with given level (priority).
[294] Fix | Delete
#
[295] Fix | Delete
# @param lvl Numeric logging level.
[296] Fix | Delete
# @param msg Message.
[297] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[298] Fix | Delete
#
[299] Fix | Delete
# @note This function is not supposed to be called manually. Please use
[300] Fix | Delete
# dtrace(), ddebug(), or others instead which wrap this one.
[301] Fix | Delete
#
[302] Fix | Delete
# This is core logging function which logs given message to standard error, file
[303] Fix | Delete
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
[304] Fix | Delete
# The format is following:
[305] Fix | Delete
#
[306] Fix | Delete
# <tt>X: some message</tt>
[307] Fix | Delete
#
[308] Fix | Delete
# where @c X is the first letter of logging level. See module description for
[309] Fix | Delete
# details on that.
[310] Fix | Delete
#
[311] Fix | Delete
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
[312] Fix | Delete
# following:
[313] Fix | Delete
# - @c FATAL to @c crit
[314] Fix | Delete
# - @c ERROR to @c error
[315] Fix | Delete
# - @c WARN to @c warning
[316] Fix | Delete
# - @c INFO to @c info
[317] Fix | Delete
# - @c DEBUG and @c TRACE both to @c debug
[318] Fix | Delete
_do_dlog() {
[319] Fix | Delete
local lvl="$1"; shift
[320] Fix | Delete
local lvlc=$(_lvl2char "$lvl") || return 0
[321] Fix | Delete
local msg="$*"
[322] Fix | Delete
local lmsg="$lvlc: $*"
[323] Fix | Delete
[324] Fix | Delete
(( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
[325] Fix | Delete
[326] Fix | Delete
if (( $lvl <= $sysloglvl )); then
[327] Fix | Delete
if [[ "$_dlogfd" ]]; then
[328] Fix | Delete
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
[329] Fix | Delete
else
[330] Fix | Delete
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
[331] Fix | Delete
fi
[332] Fix | Delete
fi
[333] Fix | Delete
[334] Fix | Delete
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
[335] Fix | Delete
echo "$lmsg" >>"$logfile"
[336] Fix | Delete
fi
[337] Fix | Delete
[338] Fix | Delete
(( $lvl <= $kmsgloglvl )) && \
[339] Fix | Delete
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
## @brief Internal helper function for _do_dlog()
[343] Fix | Delete
#
[344] Fix | Delete
# @param lvl Numeric logging level.
[345] Fix | Delete
# @param msg Message.
[346] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[347] Fix | Delete
#
[348] Fix | Delete
# @note This function is not supposed to be called manually. Please use
[349] Fix | Delete
# dtrace(), ddebug(), or others instead which wrap this one.
[350] Fix | Delete
#
[351] Fix | Delete
# This function calls _do_dlog() either with parameter msg, or if
[352] Fix | Delete
# none is given, it will read standard input and will use every line as
[353] Fix | Delete
# a message.
[354] Fix | Delete
#
[355] Fix | Delete
# This enables:
[356] Fix | Delete
# dwarn "This is a warning"
[357] Fix | Delete
# echo "This is a warning" | dwarn
[358] Fix | Delete
dlog() {
[359] Fix | Delete
[ -z "$maxloglvl" ] && return 0
[360] Fix | Delete
(( $1 <= $maxloglvl )) || return 0
[361] Fix | Delete
[362] Fix | Delete
if (( $# > 1 )); then
[363] Fix | Delete
_do_dlog "$@"
[364] Fix | Delete
else
[365] Fix | Delete
while read line || [ -n "$line" ]; do
[366] Fix | Delete
_do_dlog "$1" "$line"
[367] Fix | Delete
done
[368] Fix | Delete
fi
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
## @brief Logs message at TRACE level (6)
[372] Fix | Delete
#
[373] Fix | Delete
# @param msg Message.
[374] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[375] Fix | Delete
dtrace() {
[376] Fix | Delete
set +x
[377] Fix | Delete
dlog 6 "$@"
[378] Fix | Delete
[ -n "$debug" ] && set -x || :
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
## @brief Logs message at DEBUG level (5)
[382] Fix | Delete
#
[383] Fix | Delete
# @param msg Message.
[384] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[385] Fix | Delete
ddebug() {
[386] Fix | Delete
set +x
[387] Fix | Delete
dlog 5 "$@"
[388] Fix | Delete
[ -n "$debug" ] && set -x || :
[389] Fix | Delete
}
[390] Fix | Delete
[391] Fix | Delete
## @brief Logs message at INFO level (4)
[392] Fix | Delete
#
[393] Fix | Delete
# @param msg Message.
[394] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[395] Fix | Delete
dinfo() {
[396] Fix | Delete
set +x
[397] Fix | Delete
dlog 4 "$@"
[398] Fix | Delete
[ -n "$debug" ] && set -x || :
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
## @brief Logs message at WARN level (3)
[402] Fix | Delete
#
[403] Fix | Delete
# @param msg Message.
[404] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[405] Fix | Delete
dwarn() {
[406] Fix | Delete
set +x
[407] Fix | Delete
dlog 3 "$@"
[408] Fix | Delete
[ -n "$debug" ] && set -x || :
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
## @brief It's an alias to dwarn() function.
[412] Fix | Delete
#
[413] Fix | Delete
# @param msg Message.
[414] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[415] Fix | Delete
dwarning() {
[416] Fix | Delete
set +x
[417] Fix | Delete
dwarn "$@"
[418] Fix | Delete
[ -n "$debug" ] && set -x || :
[419] Fix | Delete
}
[420] Fix | Delete
[421] Fix | Delete
## @brief Logs message at ERROR level (2)
[422] Fix | Delete
#
[423] Fix | Delete
# @param msg Message.
[424] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[425] Fix | Delete
derror() {
[426] Fix | Delete
set +x
[427] Fix | Delete
dlog 2 "$@"
[428] Fix | Delete
[ -n "$debug" ] && set -x || :
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
## @brief Logs message at FATAL level (1)
[432] Fix | Delete
#
[433] Fix | Delete
# @param msg Message.
[434] Fix | Delete
# @retval 0 It's always returned, even if logging failed.
[435] Fix | Delete
dfatal() {
[436] Fix | Delete
set +x
[437] Fix | Delete
dlog 1 "$@"
[438] Fix | Delete
[ -n "$debug" ] && set -x || :
[439] Fix | Delete
}
[440] Fix | Delete
[441] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function