Jump to content

Loga - A logging Library


Danyfirex
 Share

Recommended Posts

Hey there, thanks for the response. I had previously written my own logger with a GUI Edit window but it has a lot less features than yours does so I've switched to yours. But mine had WordWrap in it (I don't actually recall if I set it/enabled it or if it's just enabled by default on a GUICtrlCreateEdit control by default). Anyway, as to your settings, I can start your list for you, I've figured out most of them I think:

 

Global $hLoga0  = _LogaNew()
  $iLogGuiW       = 580
  $iLogGuiH       = 240
  $sLogaFontSize  = '9'                      ; set a universal font size
  $hLoga0.Name             = 'Automation Log'
  $hLoga0.Format           = ' {LevelName} {Message}'
  $hLoga0.FilePath         = $sPathJob & '\' & 'Auto.log'
  $hLoga0.LogFileAutoFlush = False           ; false makes it wipe log on each run
  $hLoga0.LogToFile        = True
  $hLoga0.LogToGUI         = True
  $hLoga0.Width            = $iLogGuiW
  $hLoga0.Height           = $iLogGuiH
  $hLoga0.Left             = @DesktopWidth-$iLogGuiW-84
  $hLoga0.Top              = @DesktopHeight-$iLogGuiH-60
  $hLoga0.GUIBkColor       = '0x000000'
  $hLoga0.Trans            = '230'
  $hLoga0.TraceFontColor   = '0xfff0a7'
  $hLoga0.TraceFontSize    = $sLogaFontSize
  $hLoga0.DebugFontColor   = '0xffab64'
  $hLoga0.DebugFontSize    = $sLogaFontSize
  $hLoga0.InfoFontColor    = '0xd0d0d0'
  $hLoga0.InfoFontSize     = $sLogaFontSize
  $hLoga0.WarnFontColor    = '0x53b6ff'
  $hLoga0.WarnFontSize     = $sLogaFontSize
  $hLoga0.ErrorFontColor   = '0x4a22a8'
  $hLoga0.ErrorFontSize    = $sLogaFontSize
  $hLoga0.FatalFontColor   = '0x0000FF'
  $hLoga0.FatalFontSize    = $sLogaFontSize
  _LogaRefreshSettings($hLoga0)

 

Link to comment
Share on other sites

I figured out the answer to my own question, word wrap can be "enabled" by removing the "horizontal scroll" ($WS_HSCROLL) setting from the _GUICtrlRichEdit_Create inside of your function __CreateLogGUI on (or near) line 902 in Loga.au3:

Local $hRitchEdit = _GUICtrlRichEdit_Create($hGUI, "", 0, 0, $iWidth, $iHeight, $ES_READONLY + $ES_MULTILINE + $WS_VSCROLL + $ES_AUTOVSCROLL)

Also I noticed that the Console kept printing out the font name on the line right after the log message. Not sure if this was intentional or an oversight/bug, but that can be fixed by commenting out the:

ConsoleWrite($iFontName & @CRLF)

on (or near) line 724

 

Link to comment
Share on other sites

Thank you Sylice. I'll fix that issue. I think I forgot to remove that line.

 

Saludos

Link to comment
Share on other sites

  • 1 month later...

If you find the time, could you replace your consolewrites with

Func _ConsoleWrite($s)
    ConsoleWrite(BinaryToString(StringToBinary($s, 4), 1))
EndFunc

taken from Jos here? Would allow it to write special characters like äöüß into the console 😀

best regards,
Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

I'm not sure about It because I can write soecuak characters without that trick.

Screenshot_1.png.bf0c581fd37a479f89078045ef9745a0.png

Saludos

Link to comment
Share on other sites

Funny... hm, are your scripts UTF-8 encoded?  I made this the default for my scripts...

Edit 2021-05-20: Found the reason! 
I screwed up my user options file (has been grown and changed over the years). After going to "Options - Open User Options File" in Scite, I removed everything in it and just left "NewFileEncoding=UTF8BOM" as content. Now the german characters display normaly.
And I thought, this behaviour would be normal, hehe...

2021-05-18 14_50_07-Window.png

2021-05-18 14_50_18-Window.png

Edited by Marc
found solution

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 2 months later...

I see one small problem. If you use the GUI window and close it. Now the script starts calling interrupts and all programs lose focus.

#include <Date.au3>
#include "Loga.au3"

Global $sSettings1='LogToGUI="true", TraceFontSize="15", Width="1000", FilePath="t:\output.log", Format="{Symbol}{LevelName} {Message} ' & @TAB & 'Error={Error} Extended={Extended}", Name="Write Log File 4 Test" '
Global $hLoga1=_LogaNew($sSettings1)

While 1
    _LogaTrace("I'm Trace " & _NowTime())
    Sleep (1000)
WEnd

And further. If I do not use the first char {Symbol}. then the program will cut the output by one character. Trace] not [Trace]

Link to comment
Share on other sites

Hello. @mike2003  thank you for showing the issue. Updated on GitHub.

 

Saludos

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...