Results 1 to 3 of 3

Thread: Log007 - lightweight logger with license to kill

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Log007 - lightweight logger with license to kill

    This custom logging solution allows you to log messages as usual, but some logging severities have special behaviour, allowing to trigger execution stop or check for error.
    I started developing it as part of solution for my m15Model project, but it is independent and can be used in any application.

    Log007 is provided with full source code and unit tests here:
    https://github.com/petrSchreiber/Log007

    The official documentation and example of use is available at Wiki.
    The latest release is available for download.

    Just to give idea:
    Uses "file"
    
    #INCLUDE "log007.tbasicu"
    
    Global agent As Log007("log.txt")
    
    Function TBMain()
    
      agent.Note("debug", Function_Name, "Program started")
      String buffer = LoadData("C:\Not\Really\Existing.txt")
      
      If agent.InTrouble Then
        MsgBox 0, agent.LastTrouble
      Else
        MsgBox 0, buffer
      End If
      
    End Function
    
    Function LoadData(fileName As String) As String
    
      If FILE_Exists() Then
        Return FILE_Load(fileName)
      Else  
        agent.Note("error", Function_Name, "Could not locate " + fileName)
      End If
      
    End Function
    
    Produces this log file:
    03-26-2016 19:43:49 (DEBUG) [TBMAIN] Program started
    03-26-2016 19:43:49 (ERROR) [LOADDATA] Could not locate C:\Not\Really\Existing.txt

    Petr
    Last edited by Petr Schreiber; 26-03-2016 at 22:57.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Updated with new release, to fix gitHub line endings to CRLF. Thanks Primo!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Update with new release, to allow control over file writes.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. Schools kill creativity
    By Charles Pegge in forum Shout Box Area
    Replies: 3
    Last Post: 21-11-2010, 00:09
  2. An internet kill switch?
    By LanceGary in forum Shout Box Area
    Replies: 2
    Last Post: 22-06-2010, 06:29
  3. Kill a Timer immediately
    By martin in forum thinBasic General
    Replies: 6
    Last Post: 26-06-2009, 15:49
  4. New License Agreement
    By catventure in forum thinBasic General
    Replies: 4
    Last Post: 08-09-2006, 21:35

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •