logsink

class logsink[source]

tool for logsink

Methods Summary

clearFilterMsgList

Clear list of messages to be filter out

filter

Set the filter level of logging messages to be displayed.

filterMsg

Add messages to the filter out list

getMemoryTotal

Returns the memory total value from HostInfo

getNumCPUs

Returns the number of CPUs from HostInfo

getOrigin

Gets the origin of messages to be displayed

getstatslogfile

String representation of statistics logfile path

id

Returns the ID of the LogSink in use

localId

Returns the id for this class

logfile

Returns the full path of the log file

logsink

Construct a logsink tool

ompGetNumThreads

Returns the number of OpenMP threads in the current parallel region

ompNumThreadsTest

Determines the number of OpenMP threads in the current parallel region using an OpenMP reduction pragma

ompSetNumThreads

Specifies the number of OpenMP threads used by default in subsequent parallel regions

origin

Sets the origin of messages to be displayed

post

If the message passes the filter, write it (same as postLocally)

postLocally

If the message passes the filter, write it

poststat

Write telemetry data

processorOrigin

Sets the CASA processor origin which is shown at the end of each log origin

setMemoryFraction

Sets the memory fraction value to be returned by HostInfo

setMemoryTotal

Sets the memory total value to be returned by HostInfo

setNumCPUs

Sets the number of CPUs to be returned by HostInfo

setglobal

Set this logger to be the global logger

setlogfile

Set the name of file for logger output

setstatslogfile

Set the name of file for logger output

showconsole

Choose to send messages to the console/terminal

version

Returns the version of CASA as well as sending it to the log

clearFilterMsgList()[source]

Clear list of messages to be filter out

filter(level='ERROR')[source]

Set the filter level of logging messages to be displayed. This will determine what log messages go into the log file. The logger itself can adjust what gets displayed so you could set INFO5 and then filter in the logger everything above INFO1.

Parameters

  • level (string='ERROR') - Level of messages to display to the console/log file

Returns

bool

filterMsg(msgList='')[source]

Add messages to the filter out list

Parameters

  • msgList (stringVec='') - Array of strings identifying messages to filter out

Returns

void

getMemoryTotal(use_aipsrc=True)[source]

Returns the memory total value from HostInfo

Parameters

  • use_aipsrc (bool=True)

Returns

int

Examples

casalog.getMemoryTotal(True)
getNumCPUs(use_aipsrc=True)[source]

Returns the number of CPUs from HostInfo

Parameters

  • use_aipsrc (bool=True)

Returns

int

Examples

casalog.getNumCPUs(True)
getOrigin()[source]

Gets the origin of messages to be displayed

getstatslogfile()[source]

String representation of statistics logfile path

id()[source]

Returns the ID of the LogSink in use

localId()[source]

Returns the id for this class

logfile()[source]

Returns the full path of the log file

logsink(filename='casa.log', enable_telemetry=False, telemetry_logfile='False')[source]

Construct a logsink tool

Parameters

  • filename (string='casa.log') - logfile name

  • enable_telemetry (bool=False) - Allow telemetry data to be written.

  • telemetry_logfile (string='False') - Logfile for telemetry data.

ompGetNumThreads()[source]

Returns the number of OpenMP threads in the current parallel region

ompNumThreadsTest()[source]

Determines the number of OpenMP threads in the current parallel region using an OpenMP reduction pragma

ompSetNumThreads(numThreads=1)[source]

Specifies the number of OpenMP threads used by default in subsequent parallel regions

Parameters

  • numThreads (int=1)

Returns

bool

Examples

casalog.ompSetNumThreads(2)
origin(fromwhere='')[source]

Sets the origin of messages to be displayed

Parameters

  • fromwhere (string='') - The origin of a log messages

Returns

bool

post(message='', priority='INFO', origin='')[source]

If the message passes the filter, write it (same as postLocally)

Parameters

  • message (string='') - Message to be posted

  • priority (string='INFO') - Priority of message to be posted

  • origin (string='') - Origin of message to be posted

Returns

bool

postLocally(message='', priority='INFO', origin='')[source]

If the message passes the filter, write it

Parameters

  • message (string='') - Message to be posted

  • priority (string='INFO') - Priority of message to be posted

  • origin (string='') - Origin of message to be posted

Returns

bool

poststat(message='', origin='')[source]

Write telemetry data

Parameters

  • message (string='') - Message to be posted

  • origin (string='') - Origin of message to be posted

Returns

bool

processorOrigin(fromwhere='')[source]

Sets the CASA processor origin which is shown at the end of each log origin

Parameters

  • fromwhere (string='') - Input CASA processor origin name

Returns

bool

setMemoryFraction(memfrac=0)[source]

Sets the memory fraction value to be returned by HostInfo

Parameters

  • memfrac (int=0)

Returns

int

Examples

casalog.setMemoryFraction(50)
setMemoryTotal(memory=0)[source]

Sets the memory total value to be returned by HostInfo

Parameters

  • memory (int=0)

Returns

int

Examples

casalog.setMemoryTotal(4*1024)
setNumCPUs(cores=0)[source]

Sets the number of CPUs to be returned by HostInfo

Parameters

  • cores (int=0)

Returns

int

Examples

casalog.setNumCPUs(4)
setglobal(isglobal=True)[source]

Set this logger to be the global logger

Parameters

  • isglobal (bool=True) - Use as global logger

Returns

bool

setlogfile(filename='casapy.log')[source]

Set the name of file for logger output

Parameters

  • filename (string='casapy.log') - filename for logger

Returns

bool

setstatslogfile(filename='casapy.log')[source]

Set the name of file for logger output

Parameters

  • filename (string='casapy.log') - filename for logger

Returns

bool

showconsole(onconsole=False)[source]

Choose to send messages to the console/terminal

Parameters

  • onconsole (bool=False) - All messages to the console as well as log file

Returns

bool

version()[source]

Returns the version of CASA as well as sending it to the log