logsink

class logsink[源代码]

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

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

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

showconsole

Choose to send messages to the console/terminal

version

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

clearFilterMsgList()[源代码]

Clear list of messages to be filter out

filter(level='ERROR')[源代码]

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='')[源代码]

Add messages to the filter out list

Parameters

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

Returns

void

getMemoryTotal(use_aipsrc=True)[源代码]

Returns the memory total value from HostInfo

Parameters

  • use_aipsrc (bool=True)

Returns

int

Examples

casalog.getMemoryTotal(True)
getNumCPUs(use_aipsrc=True)[源代码]

Returns the number of CPUs from HostInfo

Parameters

  • use_aipsrc (bool=True)

Returns

int

Examples

casalog.getNumCPUs(True)
getOrigin()[源代码]

Gets the origin of messages to be displayed

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(filename='casa.log')[源代码]

Construct a logsink tool

Parameters

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

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(numThreads=1)[源代码]

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='')[源代码]

Sets the origin of messages to be displayed

Parameters

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

Returns

bool

post(message='', priority='INFO', origin='')[源代码]

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='')[源代码]

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

processorOrigin(fromwhere='')[源代码]

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)[源代码]

Sets the memory fraction value to be returned by HostInfo

Parameters

  • memfrac (int=0)

Returns

int

Examples

casalog.setMemoryFraction(50)
setMemoryTotal(memory=0)[源代码]

Sets the memory total value to be returned by HostInfo

Parameters

  • memory (int=0)

Returns

int

Examples

casalog.setMemoryTotal(4*1024)
setNumCPUs(cores=0)[源代码]

Sets the number of CPUs to be returned by HostInfo

Parameters

  • cores (int=0)

Returns

int

Examples

casalog.setNumCPUs(4)
setglobal(isglobal=True)[源代码]

Set this logger to be the global logger

Parameters

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

Returns

bool

setlogfile(filename='casapy.log')[源代码]

Set the name of file for logger output

Parameters

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

Returns

bool

showconsole(onconsole=False)[源代码]

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()[源代码]

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