| xHarbour Reference Documentation > Command Reference |
![]() |
![]() |
![]() |
Selects a style for logging data to log channels.
SET LOG STYLE <nStyle>
Formatting constants for log messages
| Constant | Value | Description |
|---|---|---|
| HB_LOG_ST_DATE *) | 0x0001 | Includes the date |
| HB_LOG_ST_TIME *) | 0x0002 | Includes the time as hh:mm:ss |
| HB_LOG_ST_SECS | 0x0004 | Includes seconds |
| HB_LOG_ST_LEVEL *) | 0x0008 | Includes priority level |
| HB_LOG_ST_ISODATE | 0x0010 | Includes ISO date |
| HB_LOG_ST_NAME | 0x0020 | Includes EXE file |
| *) default style | ||
!END
The SET LOG STYLE command defines the output format of a log entry created with the LOG command. Default information like date and time stamps, or the priority level, can be included or excluded from a log entry.
| See also: | CLOSE LOG, INIT LOG, LOG, TraceLog() |
| Category: | Log commands , xHarbour extensions |
| Header: | hblog.ch |
| Source: | rtl\hblog.prg, rtl\hblognet.prg |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays log messages to the console and
// demonstrates different formatting styles for log messages.
#include "Hblog.ch"
PROCEDURE Main
INIT LOG Console()
LOG "DEFAULT STYLE"
SET LOG STYLE HB_LOG_ST_DATE
LOG "HB_LOG_ST_DATE"
SET LOG STYLE HB_LOG_ST_TIME
LOG "HB_LOG_ST_TIME"
SET LOG STYLE HB_LOG_ST_SECS
LOG "HB_LOG_ST_SECS"
SET LOG STYLE HB_LOG_ST_LEVEL
LOG "HB_LOG_ST_LEVEL"
SET LOG STYLE HB_LOG_ST_ISODATE
LOG "HB_LOG_ST_ISODATE"
SET LOG STYLE HB_LOG_ST_NAME
LOG "HB_LOG_ST_NAME"
SET LOG STYLE HB_LOG_ST_NAME + HB_LOG_ST_ISODATE + HB_LOG_ST_SECS
LOG "HB_LOG_ST_NAME + HB_LOG_ST_ISODATE + HB_LOG_ST_SECS"
CLOSE LOG
RETURN
http://www.xHarbour.com