T1_InitLib()
. Specifying LOGFILE
as
argument leads to using a logfile and NO_LOGFILE
suppresses the use of a
logfile.
The name of this logfile is by default t1lib.log
. This name is defined
in t1misc.h
and can be changed there as the user likes.
Basically t1lib distinguishes 4 types of runtime messages. Each type is associated a ``loglevel'':
T1LOG_ERROR
(=1),
T1LOG_WARNING
(=2), T1LOG_STATISTIC
(=3) or T1LOG_DEBUG
(=4). All messages whose level is below or equal to this value are put into the
logfile. The user may set this loglevel by calling
void T1_SetLogLevel( int level)
T1LOG_WARNING
which means that error and warning
messages are stored in the logfile.
If the usage of a logfile has been specified, t1lib tries first to open it in the current directory. If this fails for some reason t1lib tries to create it in the user's home directory. If this fails too, an error message is printed to stderr and no logfile is used.
If the application programmer chose not to create a logfile, it would be hardly
possible for a user to track down possible problems, e.g. in file
searching. To overcome this disadvantage, the user may set an environment
variable T1LIB_LOGMODE
at runtime. This variable is evaluated by
t1lib when T1_InitLib()
is called. If its value is one of the
four strings logDebug
, logStatistic
logWarning
and
logError
, the respective loglevel is set by t1lib and a log file is
created, even if the programmer chose not to do so. However, if the programmer
had altered the log level after calling T1_InitLib()
, this cannot be
catched by setting the environment variable. A log file is created anyhow so
that at least error messages will be logged.
The user himself may also put some messages into the logfile. This can be achieved using
void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...)
func_ident
is a pointer to a string identifying the function that
generates the message. msg_txt
points to the text string to put
out. The distinction between a function identifier and a message text is only
formal, indicating the user should identify the function that generates the
message.
The string msg_txt
may contain format character sequences, %..
,
as known from the printf
- or scanf
standard C
functions. In this case, the ellipses indicate that a variable list of further
arguments may follow. The level
specification works as
described above: The message is only put out if the internal loglevel is
equal or greater than level
.
Here is a typical example of a log file after a (short)
xglyph
-session in which the loglevel was set
T1LOG_STATISTIC
. Among several informative messages of type S, also two
messages of type W have been generated. They stem from trying to
raster the character ``ß'' which was not in the current encoding.
(S) (Mon Jul 14 18:27:34 1997) T1_InitLib(): Initialization started (S) (Mon Jul 14 18:27:34 1997) T1_InitLib(): Initialization succesfully finished (S) (Mon Jul 14 18:27:44 1997) T1_LoadFont(): VM for Font 0: 35132 bytes (S) (Mon Jul 14 18:27:44 1997) CreateNewFontSize(): New Size 100.000000 created for FontID 0 (antialias=0) (S) (Mon Jul 14 18:27:53 1997) CreateNewFontSize(): New Size 100.000000 created for FontID 0 (antialias=1) (S) (Mon Jul 14 18:27:53 1997) CreateNewFontSize(): New Size 200.000000 created for FontID 0 (antialias=0) (W) (Mon Jul 14 18:27:53 1997) T1_SetChar(): No black pixels found for character 223 from font 0, returning NULL (W) (Mon Jul 14 18:27:53 1997) T1_SetStringX(): T1_SetChar() returned NULL-pointer! (S) (Mon Jul 14 18:27:55 1997) T1_DeleteSize(): Size 200.000000 deleted for FontID 0 (antialias=0) (S) (Mon Jul 14 18:27:55 1997) T1_DeleteSize(): Size 100.000000 deleted for FontID 0 (antialias=0) (S) (Mon Jul 14 18:27:55 1997) T1_DeleteSize(): Size 100.000000 deleted for FontID 0 (antialias=1)