freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Logging Library-GSOC


From: armin
Subject: RE: Logging Library-GSOC
Date: Sun, 24 May 2020 10:52:35 +0100

Hi Priyesh,

> 2. Modifying the output stream at runtime.
>
>    a. Dynamic change of desired output log levels.
>    b. Dynamic log redirection.
>
> [...]
>
> All of this should be configurable either with a config file or with
> environment variables.  I'm not sure how item 2 can be handled best; if this
> feature is active it maybe makes sense to force re-reading of environment
> variables and config files as sonn as a FreeType API function is called.

I believe a good way to handle point 2 (and blend in well with the rest of the 
project) is to allow overrides of the these values (from the config file or env 
variables) with dedicated functions at runtime; something like

```c
  FT_Trace_Set_Level( FT_Trace_Level  level );

  typedef void
  (*FT_Trace_Callback)( FT_Trace_Level  level,
                        const char*     fmt,
                        va_list         args );

  FT_Trace_Set_Callback( FT_Trace_Callback  callback );

  FT_Trace_Set_Default_Callback( void );
```

Note this is just a quick sketch and the actual callback function might have a 
forth parameter for the module ...  or this can be part of `fmt` and `args` ... 
 tbd :)

One thought also on the timestamps:  let's plan them flexible please (at least 
on/off toggle-able per env variable) as there's a good chance that you want to 
use your own TS format when retrieving the logs through the callback.

I totally agree with the rest :)

Have a lovely Sunday,
Armin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]