index Zimbu documentation

MODULE LOG @public

summary

     

Logging, messages and error reporting.

The log levels are defined in LOG.Leve.

ENUM  Level @public 
BITS  Flags @public  Optional flags for the message methods.
 
ARG.Bool  debugFlag @public 
ARG.Bool  verboseFlag @public 
dict<LOG.Level, int>  counts @public 
int  errorCount @public 
 
isDebug() bool @public  Return TRUE if the debug flag is on.
isVerbose() bool @public  Return TRUE if the verbose flag is on.
getFlags() string @public  Return the flags used by LOG. Useful to pass on to another program.
debug(msg, pos, flags) @public  Log a debug message, only output with "-d".
verbose(msg, pos, flags) @public  Log a message about detailed info, only output with "-vv".
info(msg, pos, flags) @public  Log an information message, only output with "-v".
report(msg, pos, flags) @public  Log a message about normal operation.
warning(msg, pos, flags) @public  Log a warning message.
error(msg, pos, flags) @public  Log an error message.
internal(msg, pos, flags) @public  Log an internal error message.
severe(msg, pos, flags) @public  Log a severe error message.
fatal(msg, pos, flags) @public  Log a fatal error message, the program will exit.
setExtraLead(lead) string @public  Set a leader to be inserted before every message.
isInfoLog() bool @public  Return TRUE if LOG.info() produces output.
isVerboseLog() bool @public  Return TRUE if LOG.verbose() produces output.
isDebugLog() bool @public  Return TRUE if LOG.debug() produces output.
log(level, msg, pos, flags) @public  Log a message at level.
reportStack(out) @public  Report the current stack backtrace, if possible.
flush() @public  Flush any output streams for messages.
getFlushInterval() int @public  Get the current flush interval.
setFlushInterval(interval) @public  Set the flush interval.
writeToFile(name, truncate) status @public 
getUseTimeStamp() bool @public 
setUseTimeStamp(on) @public 
 

members (alphabetically)

     

dict<LOG.Level, int> counts @public

ARG.Bool debugFlag @public

int errorCount @public

     

 int oldCount = LOG.errorCount
 doSomething()
 IF oldCount == LOG.errorCount
   IO.print("No errors found")
 }

ARG.Bool verboseFlag @public

PROC debug(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a debug message, only output with "-d".

PROC error(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log an error message.

PROC fatal(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a fatal error message, the program will exit.

PROC flush() @public

     

Flush any output streams for messages.

FUNC getFlags() string @public

     

Return the flags used by LOG. Useful to pass on to another program.

Returns an empty string if no flags are set. Otherwise includes a leading space for easy concatenation.

FUNC getFlushInterval() int @public

     

Get the current flush interval.

This is used for messages below error level.

FUNC getUseTimeStamp() bool @public

PROC info(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log an information message, only output with "-v".

PROC internal(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log an internal error message.

FUNC isDebug() bool @public

     

Return TRUE if the debug flag is on.

FUNC isDebugLog() bool @public

     

Return TRUE if LOG.debug() produces output.

FUNC isInfoLog() bool @public

     

Return TRUE if LOG.info() produces output.

FUNC isVerbose() bool @public

     

Return TRUE if the verbose flag is on.

FUNC isVerboseLog() bool @public

     

Return TRUE if LOG.verbose() produces output.

PROC log(LOG.Level level, string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a message at level.

PROC report(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a message about normal operation.

PROC reportStack(IO.I_Writer out) @public

     

Report the current stack backtrace, if possible.

The first entry is the caller of this method.

FUNC setExtraLead(string lead) string @public

     

Set a leader to be inserted before every message.

Returns the current extra lead. It should be restored afterwards.

 string savedLead = setExtraLead("in file \(fileName): ")
 processFile()
 setExtraLead(savedLead)

PROC setFlushInterval(int interval) @public

     

Set the flush interval.

This is used for messages below error level.

PROC setUseTimeStamp(bool on) @public

PROC severe(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a severe error message.

PROC verbose(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a message about detailed info, only output with "-vv".

PROC warning(string msg, Z.Pos pos, LOG.Flags flags) @public

     

Log a warning message.

FUNC writeToFile(string name, bool truncate) status @public

license

      Copyright 2014 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0