1
0
Fork 0
mirror of https://github.com/zplug/zplug synced 2024-05-03 22:26:45 +02:00

Redesigne the logging system and made it simple

This commit is contained in:
b4b4r07 2016-12-14 21:02:18 +09:00
parent 9cda2bdf07
commit d87d318af7
32 changed files with 130 additions and 372 deletions

View File

@ -45,7 +45,7 @@ do
# Evaluate IF tag and bypass existance check if conditions are not met
tags[if]="$(__zplug::core::core::run_interfaces 'if' "$repo")"
if [[ -n $tags[if] ]]; then
if ! eval "$tags[if]" 2> >(__zplug::io::log::capture) >/dev/null; then
if ! eval "$tags[if]" 2> >(__zplug::log::capture::error) >/dev/null; then
$is_verbose && __zplug::io::print::die "$repo: (bypassed check)\n"
continue
fi

View File

@ -75,7 +75,7 @@ else
__zplug::core::core::run_interfaces \
'dir' \
"$repo" \
2> >(__zplug::io::log::capture)
2> >(__zplug::log::capture::error)
)"
if [[ -d $tags[dir] ]]; then
case "$tags[from]" in
@ -110,7 +110,7 @@ do
# Clear cache
__zplug::core::core::run_interfaces 'clear'
fi \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
__zplug::io::print::put "\n"
done

View File

@ -2,12 +2,12 @@
# Description:
# Show the report of zplug errors
if [[ ! -f $ZPLUG_ERROR_LOG ]] || [[ ! -s $ZPLUG_ERROR_LOG ]]; then
if [[ ! -f $_zplug_log[trace] ]] || [[ ! -s $_zplug_log[trace] ]]; then
__zplug::io::print::f \
--die \
--zplug \
--error \
"ZPLUG_ERROR_LOG: is not found or empty\n"
"The trace log is not found or empty\n"
return 1
fi
@ -18,21 +18,21 @@ do
arg="$1"
case "$arg" in
edit)
${=${2:+$2}:-${EDITOR:-vim}} "$ZPLUG_ERROR_LOG"
${=${2:+$2}:-${EDITOR:-vim}} "$_zplug_log[trace]"
return $status
;;
jq)
if (( ! $+commands[jq] )); then
return 1
fi
cat "$ZPLUG_ERROR_LOG" \
cat "$_zplug_log[trace]" \
| sed -e 's/[[:cntrl:]]//g' \
| jq ${=${2:+"$argv[2,-1]"}:-"."}
return $status
;;
less | more)
# $PAGER
cat "$ZPLUG_ERROR_LOG" \
cat "$_zplug_log[trace]" \
| $arg
return $status
;;
@ -40,16 +40,16 @@ do
# compatible
;;
clear)
rm -f "$ZPLUG_ERROR_LOG"
rm -f "$_zplug_log[trace]"
return $status
;;
count)
cat "$ZPLUG_ERROR_LOG" \
cat "$_zplug_log[trace]" \
| grep -c ''
return $status
;;
latest)
cat "$ZPLUG_ERROR_LOG" \
cat "$_zplug_log[trace]" \
| tail -n ${${2:+"$argv[2,-1]"}:-1} \
| ${=${${commands[jq]:+"jq ."}:-"cat -"}}
return $status
@ -66,4 +66,4 @@ do
shift
done
cat "$ZPLUG_ERROR_LOG"
cat "$_zplug_log[trace]"

View File

@ -73,12 +73,6 @@ __zplug::core::add::proc_at-sign()
local name="$1" key
local -i max=0
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
for key in "${(k)zplugs[@]}"
do
if [[ $key =~ ^$name@*$ ]] && (( $max < $#key )); then

View File

@ -2,12 +2,6 @@ __zplug::core::arguments::exec()
{
local arg="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
reply=()
__zplug::core::commands::user_defined
@ -31,12 +25,6 @@ __zplug::core::arguments::auto_correct()
local -i ret=0
local -a cmds reply_cmds
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
reply_cmds=()
# Add user-defined commands

View File

@ -110,7 +110,7 @@ __zplug::core::cache::diff()
$ZPLUG_USE_CACHE || return 2
if [[ -d $ZPLUG_CACHE_DIR ]]; then
2> >(__zplug::io::log::capture) >/dev/null \
2> >(__zplug::log::capture::error) >/dev/null \
diff -b \
<(__zplug::core::cache::expose) \
<(__zplug::core::interface::expose)

View File

@ -69,12 +69,6 @@ __zplug::core::core::run_interfaces()
local interface
local -i ret=0
if [[ -z $arg ]]; then
__zplug::io::log::error \
"too few arguments"
return 1
fi
interface="__${arg:gs:_:}__"
# Do autoload if not exists in $functions
@ -219,8 +213,7 @@ __zplug::core::core::variable()
typeset -gx -A _zplug_log _zplug_build_log
_zplug_log=(
"error" "$ZPLUG_HOME/log/error.log"
"execution" "$ZPLUG_HOME/log/execution.log"
"trace" "$ZPLUG_HOME/log/trace.log"
"install" "$ZPLUG_HOME/log/install.log"
"update" "$ZPLUG_HOME/log/update.log"
"status" "$ZPLUG_HOME/log/status.log"

View File

@ -193,7 +193,7 @@ __zplug::core::load::skip_condition()
fi
if [[ -n $tags[if] ]]; then
if ! eval "$tags[if]" 2> >(__zplug::io::log::capture) >/dev/null; then
if ! eval "$tags[if]" 2> >(__zplug::log::capture::error) >/dev/null; then
if (( $_zplug_boolean_true[(I)$is_verbose] )); then
__zplug::io::print::die "$tags[name]: (not loaded)\n"
fi

View File

@ -2,12 +2,6 @@ __zplug::core::migration::tags()
{
local key="$1" new_key
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
case "$key" in
"of")
new_key="use"

View File

@ -5,7 +5,7 @@ __zplug::core::self::init()
local dst="$ZPLUG_HOME/init.zsh"
if [[ ! -f $src ]]; then
__zplug::io::log::error \
__zplug::log::write::error \
"$src: no such file or directory"
return 1
fi
@ -53,7 +53,7 @@ __zplug::core::self::update()
"$_ZPLUG_VERSION" \
"$em[under]$HEAD[1,8]$reset_color"
__zplug::io::log::info "zplug is up-to-date"
__zplug::log::write::info "zplug is up-to-date"
return $_zplug_status[self_return]
}

View File

@ -2,12 +2,6 @@ __zplug::core::sources::is_exists()
{
local source_name="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
[[ -f $ZPLUG_ROOT/base/sources/$source_name.zsh ]]
return $status
}
@ -17,12 +11,6 @@ __zplug::core::sources::is_handler_defined()
local subcommand="$1" source_name="$2" handler_name
handler_name="__zplug::sources::$source_name::$subcommand"
if (( $# < 2 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
if ! __zplug::core::sources::is_exists "$source_name"; then
return $_zplug_status[failure]
fi
@ -40,17 +28,11 @@ __zplug::core::sources::use_handler()
repo="$3"
local handler_name="__zplug::sources::$source_name::$subcommand"
if (( $# < 3 )); then
__zplug::io::log::error \
"too few arguments"
return 1
if ! __zplug::core::sources::is_handler_defined "$subcommand" "$source_name"; then
# Callback function is undefined
return $_zplug_status[failure]
fi
if ! __zplug::core::sources::is_handler_defined "$subcommand" "$source_name"; then
# Callback function is undefined
return $_zplug_status[failure]
fi
eval "$handler_name '$repo'"
return $status
}
@ -59,12 +41,6 @@ __zplug::core::sources::call()
{
local val="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
if __zplug::core::sources::is_exists "$val"; then
{
# Directory '/base/sources' needs to be included in FPATH
@ -72,7 +48,7 @@ __zplug::core::sources::call()
eval "$val.zsh"
unfunction "$val.zsh"
} \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
fi
}

View File

@ -11,12 +11,6 @@ __zplug::core::tags::parse()
local -A tags
local -a pairs
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::core::tags::get
tags=( "${reply[@]}" )

View File

@ -1,133 +0,0 @@
__zplug::io::log::with_json()
{
# Variables for error report
# - $funcfiletrace[@]
# - $funcsourcetrace[@]
# - $funcstack[@]
# - $functrace[@]
local -i i
local level="${1:-"ERROR"}"
local message="$(<&0)"
if [[ -z $message ]]; then
return 0
fi
# Spit out to JSON
printf '{'
printf '"pid": %d,' "$$"
printf '"shlvl": %d,' "$SHLVL"
printf '"level": "%s",' "$level"
printf '"dir": "%s",' "$PWD"
printf '"message": '
printf "$message" | __zplug::utils::shell::json_escape
printf ','
printf '"trace": ['
for ((i = 1; i < $#functrace; i++))
do
printf '"%s",' "$functrace[$i]"
done
printf '"%s"' "$functrace[$#functrace]"
printf "],"
printf '"date": "%s"' "$(strftime "%FT%T%z" $EPOCHSECONDS)"
printf "}\n"
}
__zplug::io::log::level()
{
local level="${(U)1:-"INFO"}" log_level
local -i part="${2:-2}"
local -A syslog_code
# https://tools.ietf.org/html/rfc5424
syslog_code=(
'' '0:Emergency:system is unusable'
'' '1:Alert:action must be taken immediately'
'' '2:Critical:critical conditions'
'ERROR' '3:Error:error conditions'
'WARN' '4:Warning:warning conditions'
'' '5:Notice:normal but significant condition'
'INFO' '6:Informational:informational messages'
'DEBUG' '7:Debug:debug-level messages'
)
if (( ! $+syslog_code[$level] )); then
level="INFO"
fi
if (( $part > 3 )); then
part=0
fi
echo "$syslog_code[$level]" \
| awk -F: '{print $'"$part"'}' \
| read log_level
echo "${(U)log_level}"
}
__zplug::io::log::new()
{
local key value
local level="WARN"
local -a args
__zplug::utils::shell::getopts "$argv[@]" \
| while read key value; \
do
case "$key" in
level)
level="$value"
;;
_)
args+=( "$value" )
esac
done
level="$(__zplug::io::log::level "$level")"
echo "$args[@]" \
| __zplug::io::log::with_json "$level" \
| >>|"$ZPLUG_ERROR_LOG"
}
__zplug::io::log::capture()
{
__zplug::io::log::with_json "ERROR" \
| >>|"$ZPLUG_ERROR_LOG"
}
__zplug::io::log::capture_error()
{
__zplug::io::log::with_json "ERROR" \
| >>|"$_zplug_log[error]"
}
__zplug::io::log::capture_execution()
{
__zplug::io::log::with_json "DEBUG" \
| >>|"$_zplug_log[execution]"
}
__zplug::io::log::info()
{
__zplug::io::log::new \
--level="INFO" \
-- \
"$argv[@]"
}
__zplug::io::log::warn()
{
__zplug::io::log::new \
--level="WARN" \
-- \
"$argv[@]"
}
__zplug::io::log::error()
{
__zplug::io::log::new \
--level="ERROR" \
-- \
"$argv[@]"
}

View File

@ -138,7 +138,7 @@ __zplug::io::print::f()
} >&$fd
if $is_log; then
__zplug::io::log::error \
"${(q)texts[@]}"
__zplug::log::write::error \
"$texts[@]"
fi
}

View File

@ -15,10 +15,10 @@ __zplug::job::handle::flock()
printf " timeout."
fi
printf "\n"
} 1> >(__zplug::io::log::capture)
} 1> >(__zplug::log::capture::error)
return 1
fi
break
return 1
fi
done

View File

@ -3,12 +3,6 @@ __zplug::job::hook::service()
local repo="$1" hook="$2"
local -A tags
if (( $# < 2 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::core::tags::parse "$repo"
tags=( "${reply[@]}" )
@ -30,18 +24,9 @@ __zplug::job::hook::service()
# Save a result to the log file (stdout/stderr)
eval "$tags[$hook]" \
2> >(__zplug::io::log::capture_error) \
1> >(__zplug::io::log::capture_execution)
2> >(__zplug::log::capture::error) \
1> >(__zplug::log::capture::debug)
return $status
#if (( $status != 0 )); then
# __zplug::io::print::f \
# --die \
# --zplug \
# --error \
# "'%s' failed\n" \
# "$tags[$hook]"
#fi
)
fi
}
@ -50,12 +35,6 @@ __zplug::job::hook::build()
{
local repo="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::job::hook::service \
"$repo" \
"hook-build"
@ -66,12 +45,6 @@ __zplug::job::hook::load()
{
local repo="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::job::hook::service \
"$repo" \
"hook-load"

25
base/log/capture.zsh Normal file
View File

@ -0,0 +1,25 @@
__zplug::log::capture::error()
{
local message="$(<&0)"
if [[ -z $message ]]; then
return 0
fi
__zplug::log::format::with_json \
--level "ERROR" --message "$message" "$argv[@]" \
>>|"$_zplug_log[trace]"
}
__zplug::log::capture::debug()
{
local message="$(<&0)"
if [[ -z $message ]]; then
return 0
fi
__zplug::log::format::with_json \
--level "DEBUG" --message "$message" "$argv[@]" \
>>|"$_zplug_log[trace]"
}

47
base/log/format.zsh Normal file
View File

@ -0,0 +1,47 @@
__zplug::log::format::with_json()
{
local -i i=1
local level="${1:-"INFO"}" message
local is_message_json=false
while (( $#argv > 0 ))
do
case "$argv[1]" in
--message)
message="$argv[2]"; shift
;;
--level)
level="$argv[2]"; shift
;;
--message-json)
is_message_json=true
;;
esac
shift
done
# Spit out to JSON
printf '{'
printf '"pid":%d,' "$$"
printf '"shlvl":%d,' "$SHLVL"
printf '"level":"%s",' "$level"
printf '"dir":"%s",' "$PWD"
printf '"message":'
if $is_message_json; then
printf "$message"
else
printf "$message" \
| __zplug::utils::shell::json_escape \
| tr -d '\n'
fi
printf ','
printf '"trace":['
for ((i = 1; i < $#functrace; i++))
do
printf '"%s",' "$functrace[$i]"
done
printf '"%s"' "$functrace[$#functrace]"
printf "],"
printf '"date":"%s"' "$(strftime "%FT%T%z" $EPOCHSECONDS)"
printf "}\n"
}

9
base/log/print.zsh Normal file
View File

@ -0,0 +1,9 @@
__zplug::log::print::error()
{
# No problem since this function ignores
# unrelated arguments passed
__zplug::log::format::with_json \
--level "ERROR" \
--message "$argv[1]" \
"$argv[2,-1]"
}

5
base/log/write.zsh Normal file
View File

@ -0,0 +1,5 @@
__zplug::log::write::error()
{
__zplug::log::print::error "$argv[@]" \
>>|"$_zplug_log[trace]"
}

View File

@ -22,12 +22,6 @@ __zplug::sources::gh-r::install()
{
local repo="$1" url
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
url="$(
__zplug::utils::releases::get_url \
"$repo"
@ -43,12 +37,6 @@ __zplug::sources::gh-r::update()
local repo="$1" index url
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[dir]="$(__zplug::core::core::run_interfaces 'dir' "$repo")"
tags[use]="$(__zplug::core::core::run_interfaces 'use' "$repo")"
tags[at]="$(__zplug::core::core::run_interfaces 'at' "$repo")"

View File

@ -17,12 +17,6 @@ __zplug::sources::gist::get_url()
{
local repo="$1" url_format
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
case "$ZPLUG_PROTOCOL" in
HTTPS | https)
# https://git::@github.com/%s.git

View File

@ -3,12 +3,6 @@ __zplug::sources::github::check()
local repo="$1"
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[dir]="$(
__zplug::core::core::run_interfaces \
'dir' \
@ -23,12 +17,6 @@ __zplug::sources::github::install()
{
local repo="$1"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::utils::git::clone "$repo"
return $status
}
@ -39,12 +27,6 @@ __zplug::sources::github::update()
local rev_local rev_remote rev_base
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[dir]="$(__zplug::core::core::run_interfaces 'dir' "$repo")"
tags[at]="$(__zplug::core::core::run_interfaces 'at' "$repo")"
@ -60,12 +42,6 @@ __zplug::sources::github::get_url()
{
local repo="$1" url_format
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
case "$ZPLUG_PROTOCOL" in
HTTPS | https)
# Create the format of URL used to git clone
@ -179,7 +155,7 @@ __zplug::sources::github::load_plugin()
if [[ -n $tags[ignore] ]]; then
ignore_patterns=( $(
zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo ${tags[dir]}/${~tags[ignore]}" \
2> >(__zplug::io::log::capture)
2> >(__zplug::log::capture::error)
)(N) )
for ignore in "${ignore_patterns[@]}"
do

View File

@ -5,12 +5,6 @@ __zplug::sources::local::check()
local expanded_path
local -a expanded_paths
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
__zplug::core::tags::parse "$repo"
tags=( "${reply[@]}" )
@ -27,7 +21,7 @@ __zplug::sources::local::check()
fi
done
__zplug::io::log::warn \
__zplug::log::write::error \
"no matching file or directory in $tags[dir]"
return 1
}

View File

@ -32,12 +32,6 @@ __zplug::sources::oh-my-zsh::update()
local repo="$1"
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[dir]="$(
__zplug::core::core::run_interfaces \
'dir' \
@ -158,7 +152,7 @@ __zplug::sources::oh-my-zsh::load_plugin()
if [[ -n $tags[ignore] ]]; then
ignore_patterns=( $(
zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo ${tags[dir]}/${~tags[ignore]}" \
2> >(__zplug::io::log::capture)
2> >(__zplug::log::capture::error)
)(N) )
for ignore in "${ignore_patterns[@]}"
do

View File

@ -32,12 +32,6 @@ __zplug::sources::prezto::update()
local repo="$1"
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[dir]="$(
__zplug::core::core::run_interfaces \
'dir' \
@ -170,7 +164,7 @@ __zplug::sources::prezto::load_plugin()
if [[ -n $tags[ignore] ]]; then
ignore_patterns=( $(
zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo ${tags[dir]}/${~tags[ignore]}" \
2> >(__zplug::io::log::capture)
2> >(__zplug::log::capture::error)
)(N) )
for ignore in "${ignore_patterns[@]}"
do

View File

@ -14,7 +14,7 @@ __zplug::utils::awk::path()
# There is no awk execute file in this PATH
if (( $#awk_paths == 0 )); then
__zplug::io::log::warn \
__zplug::log::write::error \
"gawk or nawk is not found"
return 1
fi
@ -42,7 +42,7 @@ __zplug::utils::awk::path()
done
if [[ $awk == "" || $variant == "mawk" ]]; then
__zplug::io::log::warn \
__zplug::log::write::error \
"gawk or nawk is not found"
return 1
fi

View File

@ -5,12 +5,6 @@ __zplug::utils::git::clone()
local -i ret=1
local -A tags default_tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
# A validation of ZPLUG_PROTOCOL
# - HTTPS (recommended)
# - SSH
@ -69,7 +63,7 @@ __zplug::utils::git::clone()
--recursive \
${=depth_option} \
"$url_format" "$tags[dir]" \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
ret=$status
fi
@ -89,12 +83,6 @@ __zplug::utils::git::checkout()
local -a do_not_checkout
local -A tags
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
tags[at]="$(__zplug::core::core::run_interfaces 'at' "$repo")"
tags[dir]="$(__zplug::core::core::run_interfaces 'dir' "$repo")"
tags[from]="$(__zplug::core::core::run_interfaces 'from' "$repo")"
@ -126,7 +114,7 @@ __zplug::utils::git::checkout()
fi
git checkout -q "$tags[at]" \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
if (( $status != 0 )); then
__zplug::io::print::f \
--die \
@ -179,7 +167,7 @@ __zplug::utils::git::merge()
git fetch
fi
git checkout -q "$git[branch]"
} 2> >(__zplug::io::log::capture) >/dev/null
} 2> >(__zplug::log::capture::error) >/dev/null
git[local]="$(git rev-parse HEAD)"
git[upstream]="$(git rev-parse "@{upstream}")"
@ -202,7 +190,7 @@ __zplug::utils::git::merge()
failed=true
fi
} \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
elif [[ $git[upstream] == $git[base] ]]; then
# need to push
@ -229,12 +217,6 @@ __zplug::utils::git::status()
local key val line
local -A tags revisions
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
git ls-remote --heads --tags https://github.com/"$repo".git \
| awk '{print $2,$1}' \
| sed -E 's@^refs/(heads|tags)/@@g' \
@ -285,15 +267,9 @@ __zplug::utils::git::get_remote_name()
{
local branch="$1" remote_name
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
remote_name="$(git config branch.${branch}.remote)"
if [[ -z $remote_name ]]; then
__zplug::io::log::warn \
__zplug::log::write::error \
"no remote repository"
return 1
fi
@ -331,7 +307,7 @@ __zplug::utils::git::get_remote_state()
origin_head="${$(git ls-remote origin HEAD)[1]}"
git rev-parse -q "$origin_head" \
2> >(__zplug::io::log::capture) >/dev/null
2> >(__zplug::log::capture::error) >/dev/null
if (( $status != 0 )); then
state="local out of date"
elif (( $ahead > 0 )); then

View File

@ -7,12 +7,6 @@ __zplug::utils::omz::depends()
local -A omz_libs
local omz_repo="$ZPLUG_REPOS/$_ZPLUG_OHMYZSH"
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
for lib_f in "$omz_repo"/lib/*.zsh(.)
do
# List funcname in the library file
@ -39,7 +33,7 @@ __zplug::utils::omz::depends()
[[ -f $t ]] || continue
sed '/^ *#/d' "$t" \
| egrep "(^|\s|['\"(\`])$lib_f($|\s|[\\\\'\")\`])" \
2> >(__zplug::io::log::capture) >/dev/null &&
2> >(__zplug::log::capture::error) >/dev/null &&
depends+=( "$omz_libs[$lib_f]" )
done
done

View File

@ -63,12 +63,6 @@ __zplug::utils::shell::glob2regexp()
local -i i=0
local glob="$1" char
if (( $# < 1 )); then
__zplug::io::log::error \
"too few arguments"
return 1
fi
printf "^"
for ((; i < $#glob; i++))
do
@ -108,7 +102,7 @@ __zplug::utils::shell::sudo()
local pw="$ZPLUG_SUDO_PASSWORD"
if [[ -z $pw ]]; then
__zplug::io::log::error \
__zplug::log::write::error \
"ZPLUG_SUDO_PASSWORD: is an invalid value\n"
return 1
fi
@ -194,7 +188,7 @@ __zplug::utils::shell::expand_glob()
if (( $#matches <= 1 )); then
matches=( $( \
zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo $pattern" \
2> >(__zplug::io::log::capture) \
2> >(__zplug::log::capture::error) \
) )
fi
@ -206,7 +200,7 @@ __zplug::utils::shell::eval()
local cmd
# Report stderr to error log
eval "${=cmd}" 2> >(__zplug::io::log::capture) >/dev/null
eval "${=cmd}" 2> >(__zplug::log::capture::error) >/dev/null
return $status
}

View File

@ -15,6 +15,7 @@ source "$ZPLUG_ROOT/autoload/init.zsh"
__zplug::base "base/*"
__zplug::base "core/*"
__zplug::base "io/*"
__zplug::base "log/*"
__zplug::base "job/*"
__zplug::base "sources/*"
__zplug::base "utils/*"

View File

@ -1,12 +0,0 @@
T_SUB "__zplug::io::log::with_json" ((
# skip
))
T_SUB "__zplug::io::log::level" ((
# skip
))
T_SUB "__zplug::io::log::new" ((
# skip
))
T_SUB "__zplug::io::log::capture" ((
# skip
))