lib: avoid duplicate inclusion
For lib/log and lib/utilities, add double-inclusion protection as we're so early in startup that these are loaded explicitly rather than through `reloader.sh` or even the early lib load loop. This *slightly* improves performance, but alsö improves debugging by reducing surface area.pull/1907/head
parent
84383cb46b
commit
78de57aeb5
11
lib/log.bash
11
lib/log.bash
|
|
@ -1,4 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
#
|
||||||
|
# A collection of logging functions.
|
||||||
|
|
||||||
|
# Avoid duplicate inclusion
|
||||||
|
if [[ -n "${__bash_it_lib_log:-}" ]]
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
__bash_it_lib_log="loaded"
|
||||||
|
|
||||||
export BASH_IT_LOG_LEVEL_ERROR=1
|
export BASH_IT_LOG_LEVEL_ERROR=1
|
||||||
export BASH_IT_LOG_LEVEL_WARNING=2
|
export BASH_IT_LOG_LEVEL_WARNING=2
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,13 @@
|
||||||
#
|
#
|
||||||
# A collection of reusable functions.
|
# A collection of reusable functions.
|
||||||
|
|
||||||
|
# Avoid duplicate inclusion
|
||||||
|
if [[ -n "${__bash_it_lib_utilities:-}" ]]
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
__bash_it_lib_utilities="loaded"
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Generic utilies
|
# Generic utilies
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue