Skip to content

Commit

Permalink
♻️ REFACTOR: #82
Browse files Browse the repository at this point in the history
  • Loading branch information
apolopena committed Mar 30, 2021
1 parent ace6b5b commit d208572
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
19 changes: 2 additions & 17 deletions bash/init-gitpod.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
#!/bin/bash

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}
# Load logger
. workspace-init-log.sh

# Load spinner
. bash/third-party/spinner.sh
Expand Down
28 changes: 28 additions & 0 deletions bash/workspace-init-logger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# workspace-init-logger.sh
# Description:
# Log wrapper for logging to workspace-init.log
#
# Usage:
# . workspace-init-logger
# log "SUCCESS: Logging to workspace-init.log"
# log "ERROR: something went wrong" - e

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}

0 comments on commit d208572

Please sign in to comment.