[Gambas-user] Wrong behaviour of logger.level

Sebastian Kulesz sebikul at ...626...
Fri Feb 21 00:07:56 CET 2014


On Feb 20, 2014 1:46 PM, "Emanuele Sottocorno" <sotema at ...626...> wrote:
>
> Hi Sebastian,
> tanks for your reply. I think there is an error into logger component.
> The doc say:
>
> Dim  hLoggerAs  Logger  <
http://gambasdoc.org/help/comp/gb.logging/logger?v3>
>
> hLogger=  New  Logger  <
http://gambasdoc.org/help/comp/gb.logging/logger?v3>  (  *[*  _iMinLevel_
 As  Integer,  _sOutput_  As  String  *]*  )
>
> Creates a new Logger
> <http://gambasdoc.org/help/comp/gb.logging/logger?v3> object
> <http://gambasdoc.org/help/def/object?v3> targeting the log file
> specified by _sOutput_. The minimum acceptable message level is
> specified by the _iMinLevel_ parameter.
>
> If _sOutput_ is not specified then log messages are sent to /stdout/.
>
> _Messages sent with a level lower than __iMinLevel__are ignored. _
>
> try this:

I believe you misunderstood the documentation.

>
> Public Sub Main()
> Dim hLog As Logger
>    hLog = New Logger(Logger.Debug)

This says: log anything more important than Debug

>    Logger.Begin
>    Logger.Log("this should not logged", Logger.Warning)

Warning is far more important than debug, so it should be logged.

I encourage you to read the rfc to get a better understanding on why this
is the expected behaviour.

> End
>
> The log message will appear inside the Gambas Console
>
> The failing instruction, I suppose, is:
>
> Public Function isEnabledFor(iLevel As Integer) As Boolean
>
>    Return (iLevel <= $iLevel) ---> should be Return (iLevel >= $iLevel)
> End

Try to self compile and install the component with this line changed, you
will see that it will appear to be broken, as it won't log almost anything!

>
> Enjoy your vacations!

Thanks! ;)

>
> Il 20/02/2014 20:57, Sebastian Kulesz ha scritto:
> > Hi! I'm the author of the gb.logging component. I'm on vacations right
now,
> > so I can't review your issue. I've starred this email and will be
taking a
> > look when I get back home. Afaik the component is working correctly, so
> > please review the documentation and the rfc on which it is based (you
can
> > find a link in the docs too)
> >
> > Sorry for my late response.
> > On Feb 20, 2014 9:29 AM, "Emanuele Sottocorno" <sotema at ...626...> wrote:
> >
> >> Il 18/02/2014 12:58, Emanuele Sottocorno ha scritto:
> >>> Maybe I misunderstood the rule, but following the wiki:
> >>>
> >>> Property Level As Integer
> >>>
> >>> Sets or returns the minimum logging level for the Logger object.
> >>>
> >>> but seems operating contrariwise. See the attached project.
> >>>
> >>> [System]
> >>> Gambas=3.5.90 (rev. 6164)
> >>> OperatingSystem=Linux
> >>> Kernel=3.11.0-15-generic
> >>> Architecture=x86_64
> >>> Distribution=Ubuntu 13.10
> >>> Desktop=GNOME
> >>> Theme=QGtk
> >>> Language=it_IT.UTF-8
> >>> Memory=7836M
> >>>
> >>> [Libraries]
> >>> Cairo=libcairo.so.2.11200.16
> >>> Curl=libcurl.so.4.3.0
> >>> DBus=libdbus-1.so.3.7.4
> >>> GStreamer=libgstreamer-0.10.so.0.30.0
> >>> GStreamer=libgstreamer-1.0.so.0.200.0
> >>> GTK+3=libgtk-3.so.0.800.6
> >>> GTK+=libgtk-x11-2.0.so.0.2400.20
> >>> OpenGL=libGL.so.1.2.0
> >>> Poppler=libpoppler.so.43.0.0
> >>> Qt4=libQtCore.so.4.8.4
> >>> SDL=libSDL-1.2.so.0.11.4
> >> Could someone answer it. Please.
> >>
> >>
> >>
------------------------------------------------------------------------------
> >> Managing the Performance of Cloud-Based Applications
> >> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> >> Read the Whitepaper.
> >>
> >>
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >
------------------------------------------------------------------------------
> > Managing the Performance of Cloud-Based Applications
> > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> > Read the Whitepaper.
> >
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list