Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TadConsole

TadConsole (Library)

This is a class that provides advanced logging.

Hierarchy

  • TadConsole

Index

Constructors

constructor

  • new TadConsole(p_strFilePath: string): TadConsole
  • Creates new instance of TadConsole class. Instantiation creates a new file the object can save itself to as JSON. This JSON structure along with some additional logging options and meta-data provides an option a little more advanced than the standard console.log("foo") option.

    Parameters

    • p_strFilePath: string

      the path to the file store for the log.

    Returns TadConsole

Properties

lastAction

lastAction: TadConsole_action

Details about the action being run at the point the log was last saved to file.

lastDraft

lastDraft: TadConsole_draft

Details about the draft (and draft version) being processed at the point the log was last saved to file.

lastSaved

lastSaved: string

The timestamp for when the log was last saved. e.g. "2020-07-18-12.13.14.150"

log

An array of sets of log entries.

path

path: string

The path to the file store for the log.

Methods

TA_addEntry

  • TA_addEntry(p_strEntry: string, p_strType?: string, p_strCode?: string): void
  • Add a log entry to the console object instance. This does not save the entry to file, it simply adds it to the console instance. The timestamp at which the entry was logged is also recorded.

    Parameters

    • p_strEntry: string

      the text to be logged.

    • Optional p_strType: string

      an optional categorisation of a log entry; defaults to an empty string.

    • Optional p_strCode: string

      an optional unique, short code for the log entry; defaults to an empty string.

      // Example
      tadCon.TA_addEntry("Lorem ipsum", "WARNING", "W01");

    Returns void

TA_arrayToSimpleText

  • Convert an array of log entries to a sorted plain text format suitable for display. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_jsonArray: TadConsole_logEntry[]

      the array of log entries, expressed in the standard log entry JSON format, to be formatted

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      alert(tadCon.TA_arrayToSimpleText(true, tadCon.log));

      Example output.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_clearLog

  • TA_clearLog(): void
  • Clear all log entries from the console object. This effectively nulls out the content of the log property of the console instance.

    // Example
    tadCon.TA_clearLog();

    Returns void

TA_clearSaveLog

  • TA_clearSaveLog(): Boolean
  • Clear all log entries from the console object and file. This effectively nulls out the content of the log property of the console instance, and saves the resulting object properties to file, effectively nulling them out there too. Returns true if the file update was successful.

    // Example
    tadCon.TA_clearSaveLog();

    Returns Boolean

TA_deleteLog

  • TA_deleteLog(): Boolean
  • Delete the log file. The file location is specified by the path property of the console instance. Returns true if the file deletion was successful.

    // Example
    tadCon.TA_deleteLog();

    Returns Boolean

TA_filterLog

  • TA_filterLog(p_bSortOldToNew: Boolean, p_strKey: string, p_strMatch: string, p_bInclude: Boolean): TadConsole_logEntry[]
  • Query the log entries with filters and sort order to return a set of matching log entries.

    Parameters

    • p_bSortOldToNew: Boolean

      when set as true, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified.

    • p_bInclude: Boolean

      determines if the key match is to be the basis of inclusion (true) or exclusion (false).

      // Example
      let arrJSONErrors = tadCon.TA_filterLog(true, "type", "ERROR", true);
      // Returns an array of log entries in JSON format with a type of 'ERROR', and sorted chronologically in the array based on the time stamp

    Returns TadConsole_logEntry[]

TA_filterLogEntries

  • TA_filterLogEntries(p_intEntryStart: number, p_intEntryEnd: number, p_bSortOldToNew?: Boolean, p_strKey?: string, p_strMatch?: string, p_bInclude?: Boolean): TadConsole_logEntry
  • Query the log entries, possibly filtered, for a range of positional matched and return the array of matching log entry objects.

    Parameters

    • p_intEntryStart: number

      the positional index of the start of the log entry range to return. Index is 1-based.

    • p_intEntryEnd: number

      the positional index of the end of the log entry range to return. Index is 1-based.

    • Optional p_bSortOldToNew: Boolean

      when set as true (the default), the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • Optional p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code), defaults to an empty string.

    • Optional p_strMatch: string

      the value of the log property to match against; an exact match should be specified, defaults to an empty string.

    • Optional p_bInclude: Boolean

      determines if the key match is to be the basis of inclusion (true, default) or exclusion (false).

      // Example
      let arrJSONLastFiveWarnings = tadCon.TA_filterLogEntries(1, 5, false, "type", "WARN", true);
      // Returns an array of the last five log entries in JSON format with a type of 'WARN', and sorted reverse chronologically in the array based on the time stamp

    Returns TadConsole_logEntry

TA_filterLogEntry

  • TA_filterLogEntry(p_intEntry: number, p_bSortOldToNew?: Boolean, p_strKey?: string, p_strMatch?: string, p_bInclude?: Boolean): TadConsole_logEntry
  • Query the log entries, possibly filtered, for a positional match and return the log entry object.

    Parameters

    • p_intEntry: number

      the positional index of the log entry to return. Index is 1-based.

    • Optional p_bSortOldToNew: Boolean

      when set as true (the default), the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • Optional p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code), defaults to an empty string.

    • Optional p_strMatch: string

      the value of the log property to match against; an exact match should be specified, defaults to an empty string.

    • Optional p_bInclude: Boolean

      determines if the key match is to be the basis of inclusion (true, default) or exclusion (false).

      // Example
      alert(tadCon.TA_filterLogEntry(1, true, "type", "ERROR", true)).entry;
      // Displays the log entry for the first error that occurs in the log instance

    Returns TadConsole_logEntry

TA_filterLogExclude

  • Return the array of log elements filtered to exclude on a key by a single match.

    Parameters

    • p_strKey: string

      the JSON key to be checked in each array element: stamp, entry, type, code.

    • p_strMatch: string

      the value held against the key which constitutes a match and thus will be excluded.

      // Example
      tadCon.TA_filterLogExclude("type", "INFO");

    Returns TadConsole_logEntry[]

TA_filterLogInclude

  • Return the array of log elements filtered to include on a key by a single match.

    Parameters

    • p_strKey: string

      the JSON key to be checked in each array element: stamp, entry, type, code.

    • p_strMatch: string

      the value held against the key which constitutes a match and thus will be included.

      // Example
      tadCon.TA_filterLogInclude("code", "123");

    Returns TadConsole_logEntry[]

TA_logEntryFirst

  • Returns the first log entry.

    // Example
    alert(tadCon.TA_logEntryFirst().entry);

    Returns TadConsole_logEntry

TA_logEntryFirstCode

  • Returns the first log entry for a specific code.

    Parameters

    • p_strCode: any

      the value to match against the code key for filtering log entries.

      // Example
      alert(tadCon.TA_logEntryFirstCode("W01").entry);

    Returns TadConsole_logEntry

TA_logEntryFirstType

  • Returns the first log entry of a specific type.

    Parameters

    • p_strType: any

      the value to match against the type key for filtering log entries.

      // Example
      alert(tadCon.TA_logEntryFirstType("WARN").entry);

    Returns TadConsole_logEntry

TA_logEntryLast

  • Returns the last log entry.

    // Example
    alert(tadCon.TA_logEntryLast().entry);

    Returns TadConsole_logEntry

TA_logEntryLastCode

  • Returns the last log entry for a specific code.

    Parameters

    • p_strCode: any

      the value to match against the code key for filtering log entries.

      // Example
      alert(tadCon.TA_logEntryLastCode("W01").entry);

    Returns TadConsole_logEntry

TA_logEntryLastType

  • Returns the last log entry of a specific type.

    Parameters

    • p_strType: any

      the value to match against the type key for filtering log entries.

      // Example
      alert(tadCon.TA_logEntryLastType("WARN").entry);

    Returns TadConsole_logEntry

TA_logExportEntriesToFile

  • TA_logExportEntriesToFile(p_strContent: string, p_bTimeStamped?: Boolean, p_strFileExtension?: string): Boolean
  • TA_logExportEntriesToFile(p_bSortOldToNew?: Boolean, p_bTimeStamped?: Boolean, p_strFileExtension?: string): Boolean
  • Log a set of text based log entries to log file. Returns true if the log file was created successfully.

    Parameters

    • p_strContent: string

      a string containing the set of processed log entries exactly as they should be written to file.

    • Optional p_bTimeStamped: Boolean

      to include a timestamp in the file name, this should be set to true, the default is false.

    • Optional p_strFileExtension: string

      the extension to use for the output file. Defaults to log.

      // Example
      tadCon.TA_logExportEntriesToFile(strProcessedLogEntries, true, "txt");

    Returns Boolean

  • Convert the array of log entries for the console object instance to a sorted plain text format and save to an optionally time stamped log file. Returns true if the log file was created successfully.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • Optional p_bTimeStamped: Boolean

      to include a timestamp in the file name, this should be set to true, the default is false.

    • Optional p_strFileExtension: string

      the extension to use for the output file. Defaults to log.

      // Example
      tadCon.TA_logExportEntriesToFile(true, true, "txt");

    Returns Boolean

TA_logExportToAlert

  • TA_logExportToAlert(p_bSortOldToNew?: Boolean): string
  • Convert the array of log entries for the console object instance to a sorted plain text format suitable for display, and display it in an alert. Displays a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToAlert(true);

      Example alert output.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_logExportToAlertExclude

  • TA_logExportToAlertExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is not made, and display it in an alert. Displays a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be excluded.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToAlertExclude("type", "ERROR", true);

      Example alert output.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.

    Returns string

TA_logExportToAlertInclude

  • TA_logExportToAlertInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made, and display it in an alert. Displays a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToAlertInclude("type", "ERROR", true);

      Example alert output.

      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_logExportToClipboard

  • TA_logExportToClipboard(p_bSortOldToNew?: Boolean): void
  • Convert the array of log entries for the console object instance to a sorted plain text format suitable for display, and place it on the clipboard. Places the set of text-based log entries on the clipboard with each log entry separated by a new line.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToClipboard(true);

      Example clipboard content.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns void

TA_logExportToClipboardExclude

  • TA_logExportToClipboardExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): void
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is not made, and place it on the clipboard. Places the set of text-based log entries on the clipboard with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be excluded.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToClipboardExclude("type", "ERROR", true);

      Example clipboard content.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.

    Returns void

TA_logExportToClipboardInclude

  • TA_logExportToClipboardInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): void
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made, and place it on the clipboard. Places the set of text-based log entries on the clipboard with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToClipboardInclude("type", "ERROR", true);

      Example clipboard content.

      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns void

TA_logExportToDraft

  • TA_logExportToDraft(p_bSortOldToNew?: Boolean): Draft
  • Convert the array of log entries for the console object instance to a sorted plain text format suitable for display, and place it in a new draft. Places a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToDraft(true);

      Example draft content.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns Draft

TA_logExportToDraftExclude

  • TA_logExportToDraftExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): Draft
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made, and place it in a new draft. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be excluded.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToDraftExclude("type", "ERROR", true);

      Example draft content.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.

    Returns Draft

TA_logExportToDraftInclude

  • TA_logExportToDraftInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): Draft
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made, and place it in a new draft. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToDraftInclude("type", "ERROR", true);

      Example draft content.

      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns Draft

TA_logExportToFileExclude

  • TA_logExportToFileExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean, p_bTimeStamped?: Boolean, p_strFileExtension?: string): Boolean
  • Convert the array of log entries to a sorted plain text format and save to an optionally time stamped log file, including only log entries where a key match is not made. Returns true if the log file was created successfully.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will not be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • Optional p_bTimeStamped: Boolean

      to include a timestamp in the file name, this should be set to true, the default is false.

    • Optional p_strFileExtension: string

      the extension to use for the output file. Defaults to log.

      // Example
      tadCon.TA_logExportToFileExclude("type", "ERROR", true, true, "txt");

    Returns Boolean

TA_logExportToFileInclude

  • TA_logExportToFileInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean, p_bTimeStamped?: Boolean, p_strFileExtension?: string): Boolean
  • Convert the array of log entries to a sorted plain text format and save to an optionally time stamped log file, including only log entries where a key match is made. Returns true if the log file was created successfully.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

    • Optional p_bTimeStamped: Boolean

      to include a timestamp in the file name, this should be set to true, the default is false.

    • Optional p_strFileExtension: string

      the extension to use for the output file. Defaults to log.

      // Example
      tadCon.TA_logExportToFileInclude("type", "ERROR", true, true, "txt");

    Returns Boolean

TA_logExportToInsert

  • TA_logExportToInsert(p_bSortOldToNew?: Boolean): string
  • Convert the array of log entries for the console object instance to a sorted plain text format suitable for display, and insert it at the current cursor position. Returns a set of text-based log entries with each log entry separated by a new line, matching the text inserted into the draft.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToInsert(true);

      Example output/inserted text.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_logExportToInsertExclude

  • TA_logExportToInsertExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is not made, and insert it at the current cursor position. Returns a set of text-based log entries with each log entry separated by a new line, matching the text inserted into the draft.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be excluded.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToInsertExclude("type", "ERROR", true);

      Example output/inserted text.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.

    Returns string

TA_logExportToInsertInclude

  • TA_logExportToInsertInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made, and insert it at the current cursor position. Returns a set of text-based log entries with each log entry separated by a new line, matching the text inserted into the draft.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      tadCon.TA_logExportToInsertInclude("type", "ERROR", true);

      Example output/inserted text.

      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_logToSimpleText

  • TA_logToSimpleText(p_bSortOldToNew?: Boolean): string
  • Convert the array of log entries for the console object instance to a sorted plain text format suitable for display. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      alert(tadCon.TA_logToSimpleText(true));

      Example output.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.
      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_logToSimpleTextExclude

  • TA_logToSimpleTextExclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be excluded.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      alert(tadCon.TA_logToSimpleTextExclude("type", "ERROR", true));

      Example output.

      2020-07-20-20.32.34.010 - INFO: Processing initiated.
      2020-07-20-20.32.34.299 - WARN: Language not specified. Defaulting to English.
      2020-07-20-20.32.34.898 - INFO: File content generated.

    Returns string

TA_logToSimpleTextInclude

  • TA_logToSimpleTextInclude(p_strKey: string, p_strMatch: string, p_bSortOldToNew?: Boolean): string
  • Convert an array of log entries to a sorted plain text format suitable for display, including only log entries where a key match is made. Returns a set of text-based log entries with each log entry separated by a new line.

    Parameters

    • p_strKey: string

      the name of the log entry property to match against (stamp, entry, type, code).

    • p_strMatch: string

      the value of the log property to match against; an exact match should be specified. Matches will be included.

    • Optional p_bSortOldToNew: Boolean

      when set as true, the default, the entries will be sorted alphabetically. Since a date/timestamp format is being used, this will put the entries in chronological order. Setting to false reverses the order and will put the latest entry at the start and the oldest entry at the end.

      // Example
      alert(tadCon.TA_logToSimpleTextInclude("type", "ERROR", true));

      Example output.

      2020-07-20-20.32.35.006 - ERROR [66]: File write for "test1.txt" failed.

    Returns string

TA_previewLogTable

  • TA_previewLogTable(p_bOptional: Boolean): Boolean
  • Display the log using a filterable, sortable table layout. An HTML preview is utilised along with a datatables implementation. This function includes some online files in the HTML for the datatable and jquery components, so connectivity is required to utilise this function. Returns true if the preview window was closed with continue, and false if it was closed with cancel.

    Parameters

    • p_bOptional: Boolean

      stamp (timestamp) and entry (log entry) are mandatory fields and are always displayed. When set to true (the default), the optional fields of type and code will also be displayed.

      // Example
      tadCon.TA_previewLogTable(false);

    Returns Boolean

TA_saveEntry

  • TA_saveEntry(p_strEntry: string, p_strType?: string, p_strCode?: string): Boolean
  • Add an entry to the console object and save any unsaved console updates to file. The file location is specified by the path property of the console instance. Returns true if the file update was successful.

    Parameters

    • p_strEntry: string

      the text to be logged.

    • Optional p_strType: string

      an optional categorisation of a log entry; defaults to an empty string.

    • Optional p_strCode: string

      an optional unique, short code for the log entry; defaults to an empty string.

      // Example
      tadCon.TA_saveEntry("Lorem ipsum", "WARNING", "W01");

    Returns Boolean

TA_saveLog

  • TA_saveLog(): Boolean
  • Save the console object to file. The file location is specified by the path property of the console instance. Returns true if the file update was successful.

    // Example
    tadCon.TA_saveLog();

    Returns Boolean

TA_snapshot

  • TA_snapshot(): Boolean
  • Snapshot a file by duplicating it in the same folder, but prefixing the file name with a time stamp. Returns true if the duplicate file was created successfully.

    // Example
    tadCon.TA_snapshot();

    Returns Boolean