Skip to content

Instantly share code, notes, and snippets.

@jkbryan
Created October 2, 2018 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkbryan/8fa2f96ea0623eb1645cd9f9c5d44a3f to your computer and use it in GitHub Desktop.
Save jkbryan/8fa2f96ea0623eb1645cd9f9c5d44a3f to your computer and use it in GitHub Desktop.
logging-example.vb
'Within the "Public Class MAExtensionObject" section, add:
'Date & Logginglevel variables for logging files:
Dim dtDateNowDay As Integer = Date.Now.Day
Dim dtDateNowMonth As Integer = Date.Now.Month
Dim dtDateNowYear As Integer = Date.Now.Year
Dim loggingLevel As Integer = 0
'================================================
'With the Sub or Function that you want logging - e.g. "Public Sub MapAttributesForImport"
Dim dtFileTime As DateTime
'Define Logfile Name then setup the logfile
Dim logFileName As String = dtDateNowDay & "-" & dtDateNowMonth & "-" & dtDateNowYear & "_MyMA_Import.log"
Logging.SetupLogFile(logFileName, loggingLevel)
'================================================
'Within a sync rule, where you want to log something - e.g. what the UPN is going to be set to:
Logging.Log("Some informational string," & csentry("samAccountName").Value & ",UPN," & csentry("mail").Value, True, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment