Re: Logging
From: McKirahan (News_at_McKirahan.com)
Date: 01/24/05
- Next message: McKirahan: "Re: Logging"
- Previous message: jlstanleyNO$pam: "Re: Trying to save a word document after it runs a macro to change formating and keep the formatting."
- In reply to: Jeffrey: "Logging"
- Next in thread: McKirahan: "Re: Logging"
- Reply: McKirahan: "Re: Logging"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 Jan 2005 10:18:59 -0600
"Jeffrey" <BigDaddy@newsgroup.nospam> wrote in message
news:uW2W$qiAFHA.2880@TK2MSFTNGP14.phx.gbl...
> Does anybody know of a object or function already written to enable
logging
> in scripts. There are several of us developing scripts and trying to get
to
> a consistent logging method for the group. I'd like to get the group to
call
> either a function or use an object and pass there information.
>
>
Will this help? Watch for word-wrap.
This appends a timestamped entry to a log file.
The format of the timestamp is "ccyy-mm-dd hh:nn:ss ".
Option Explicit
Const cVBS = "logger.vbs"
Call Logger("Hello World")
Function Logger(strLOG)
'****
'* Append to Log.
'****
Const cLOG = "logger.log"
'*
Dim arrNOW(5)
arrNOW(0) = DatePart("yyyy",Now()) & "-"
arrNOW(1) = Right(100+DatePart("m",Now()),2) & "-"
arrNOW(2) = Right(100+DatePart("d",Now()),2) & " "
arrNOW(3) = Right(100+DatePart("h",Now()),2) & ":"
arrNOW(4) = Right(100+DatePart("n",Now()),2) & ":"
arrNOW(5) = Right(100+DatePart("s",Now()),2) & " "
Dim strNOW
strNOW = Join(arrNOW,"")
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile(cLOG,8,true)
objOTF.Write(strNOW & strLOG)
Set objFSO = Nothing
Set objOTF = Nothing
End Function
- Next message: McKirahan: "Re: Logging"
- Previous message: jlstanleyNO$pam: "Re: Trying to save a word document after it runs a macro to change formating and keep the formatting."
- In reply to: Jeffrey: "Logging"
- Next in thread: McKirahan: "Re: Logging"
- Reply: McKirahan: "Re: Logging"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|