So thought Id get something written down to document my idea for a more complex log system which would more likely prove more helpful for more complex interrogations etc.
Anyway my plan is to keep a log of all updates made in Samba based on information drawn from the REST API of the PMS system I am creating an integration for.
While obviously I plan not to have any issues there is always the potential for problems moving from a test environment to a production environment.
As I am integrating 40 rooms with 8-10 fields a single line text file log would be unsuitable.
The script I have to update the rooms data will run every 10-15 minutes so plan to have a script run log which will be a single txt file per day with log of if the script ran and what rooms were updated.
I then plan to create a text file for the data which gets updated.
The planned structure would be;
C:\SambaPOS\Logs\LOG FOLDER \ YEAR \ MONTH \ DAY \
Log folder will be left as a top level directory for any future log implementations.
This one will be ‘Room Updates’
C:\ SambaPOS \ Logs \ Room Updates
My scripts will be tiered ie
`Update Script -- (Log Output: Date & Log) --> Log Script --> Log Folder Script (Using Date)`
--> Log Script Add Line (Using Date & Log)
Starting from the end backwards I have made a script to check if the date based directory exists in the log directory folder.
I have configured with the help of @QMcKay a way to define a single script page of variables to be used in all other scrips where needed allowing a single place to update variables for multiple scripts.
In this I have defined a log ‘root’ directory;
var logFolderDirectory = ‘C:/SambaPOS/Logs’
In order to create and check folder existence I had to load ActiveXObject("Scripting.FileSystemObject")
This script will take the input date and folder and create a directory for the log date;
\SambaPOS\Logs\test\2015\12\26
when script LogFolder.directoryCheck(‘26/12/2015’,‘test’) is run.
Hope someone finds this useful