xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET LOG STYLE

Selects a style for logging data to log channels.

Syntax

SET LOG STYLE <nStyle>

Arguments

<nStyle>
This is a numeric value specifying the default formatting of log entries. #define constants are available in HbLog.ch that can be used for <nStyle>. To combine different formatting instructions, pass the sum of the #define constants for <nStyle>

Formatting constants for log messages
ConstantValueDescription
HB_LOG_ST_DATE *)0x0001Includes the date
HB_LOG_ST_TIME *)0x0002Includes the time as hh:mm:ss
HB_LOG_ST_SECS0x0004Includes seconds
HB_LOG_ST_LEVEL *)0x0008Includes priority level
HB_LOG_ST_ISODATE0x0010Includes ISO date
HB_LOG_ST_NAME0x0020Includes EXE file

!END

Description

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.

Info

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

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe