summaryrefslogtreecommitdiff
path: root/userphotos/loglib.ps1
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-12-06 08:28:54 -0500
committerB Stack <bgstack15@gmail.com>2019-12-06 08:28:54 -0500
commit7bb0b40b4e3b9a9b762be7597b4cca83bf572ac3 (patch)
tree5cef789cbd8d4ddda2c16be00bd54b620acea21e /userphotos/loglib.ps1
parentadd newest-package-for-devuan (diff)
downloadformer-gists-7bb0b40b4e3b9a9b762be7597b4cca83bf572ac3.tar.gz
former-gists-7bb0b40b4e3b9a9b762be7597b4cca83bf572ac3.tar.bz2
former-gists-7bb0b40b4e3b9a9b762be7597b4cca83bf572ac3.zip
add userphotos
Diffstat (limited to 'userphotos/loglib.ps1')
-rwxr-xr-xuserphotos/loglib.ps137
1 files changed, 37 insertions, 0 deletions
diff --git a/userphotos/loglib.ps1 b/userphotos/loglib.ps1
new file mode 100755
index 0000000..92a5f40
--- /dev/null
+++ b/userphotos/loglib.ps1
@@ -0,0 +1,37 @@
+# Filename: \\util201\scripts\Functions\loglib.ps1
+# License: CC-BY-SA 4.0
+# Author: bgstack15, TAFKAC
+# Startdate: 2019-11-25 10:19
+# Title: Logging library
+# Purpose: Provide logging functions
+# History:
+# Usage:
+# Reference:
+# internal file systems-engineering/powershell/deploy-server/iad/library/functions.ps1
+# Improve:
+# Dependencies:
+#
+
+### GLOBAL VARIABLES
+$global:today = Get-Date -Format yyyy-MM-dd
+
+### FUNCTIONS
+Function Log {
+ # adapted from TAFKAC
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory = $TRUE, Position = 0)]
+ [string] $entry
+ )
+ If (!($GLOBAL:log -ne $NULL)) {
+ Set-Variable -Name log -Value @() -Scope Global;
+ }
+ $stamp = (Get-Date -Format FileDateTimeUniversal);
+ $GLOBAL:log += "[$stamp] $entry";
+ Write-Host "[$stamp] $entry" -ForegroundColor Gray
+ if ($global:logfile -ne $null)
+ {
+ $logid = ""; if ($global:logid -ne $null) {$logid = " ${global:logid}"}
+ "[$stamp] ${env:UserName}@${env:ComputerName}${logid}: $entry" | Out-File -Append $global:logfile
+ }
+}
bgstack15