Public Member Functions | Static Public Attributes | Private Attributes | List of all members
grepros.outputs.ConsoleSink Class Reference
Inheritance diagram for grepros.outputs.ConsoleSink:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, args=None, **kwargs)
 
def emit (self, topic, msg, stamp=None, match=None, index=None)
 
def emit_meta (self)
 
def is_highlighting (self)
 
- Public Member Functions inherited from grepros.outputs.Sink
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def autodetect (cls, target)
 
def bind (self, source)
 
def close (self)
 
def flush (self)
 
def thread_excepthook (self, text, exc)
 
def validate (self)
 
- Public Member Functions inherited from grepros.outputs.TextSinkMixin
def format_message (self, msg, highlight=False)
 
def message_to_yaml (self, val, top=(), typename=None)
 

Static Public Attributes

string CONTEXT_PREFIX_SEP = "-"
 
 DEFAULT_ARGS
 Constructor argument defaults. More...
 
string MATCH_PREFIX_SEP = ":"
 
string MESSAGE_SEP_TEMPLATE = "{ll0}{sep}{ll1}"
 
string META_LINE_TEMPLATE = "{ll0}{sep} {line}{ll1}"
 
string PREFIX_TEMPLATE = "{pfx0}{batch}{pfx1}{sep0}{sep}{sep1}"
 
string SEP = "---"
 
- Static Public Attributes inherited from grepros.outputs.Sink
 DEFAULT_ARGS = dict(META=False)
 Constructor argument defaults. More...
 
tuple FILE_EXTENSIONS = ()
 Auto-detection file extensions for subclasses, as (".ext", ) More...
 
- Static Public Attributes inherited from grepros.outputs.TextSinkMixin
 DEFAULT_ARGS
 Constructor argument defaults. More...
 
string NOCOLOR_HIGHLIGHT_WRAPPERS = "**", "**"
 Default highlight wrappers if not color output. More...
 

Private Attributes

 _prefix
 

Additional Inherited Members

- Public Attributes inherited from grepros.outputs.Sink
 args
 
 source
 inputs.Source instance bound to this sink More...
 
 valid
 Result of validate() More...
 

Detailed Description

Prints messages to console.

Definition at line 506 of file outputs.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.outputs.ConsoleSink.__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                       arguments as namespace or dictionary, case-insensitive
@param   args.color                 False or "never" for not using colors in replacements
@param   args.highlight             highlight matched values (default true)
@param   args.meta                  whether to print metainfo
@param   args.emit_field            message fields to emit if not all
@param   args.noemit_field          message fields to skip in output
@param   args.line_prefix           print source prefix like bag filename on each message line
@param   args.max_field_lines       maximum number of lines to print per field
@param   args.start_line            message line number to start output from
@param   args.end_line              message line number to stop output at
@param   args.max_message_lines     maximum number of lines to output per message
@param   args.lines_around_match    number of message lines around matched fields to output
@param   args.matched_fields_only   output only the fields where match was found
@param   args.wrap_width            character width to wrap message YAML output at
@param   args.match_wrapper         string to wrap around matched values,
                            both sides if one value, start and end if more than one,
                            or no wrapping if zero values
@param   kwargs                     any and all arguments as keyword overrides, case-insensitive

Reimplemented from grepros.outputs.Sink.

Definition at line 523 of file outputs.py.

Member Function Documentation

◆ emit()

def grepros.outputs.ConsoleSink.emit (   self,
  topic,
  msg,
  stamp = None,
  match = None,
  index = None 
)
Prints separator line and message text.

Reimplemented from grepros.outputs.Sink.

Definition at line 564 of file outputs.py.

◆ emit_meta()

def grepros.outputs.ConsoleSink.emit_meta (   self)
Prints source metainfo like bag header, if not already printed.

Reimplemented from grepros.outputs.Sink.

Definition at line 553 of file outputs.py.

◆ is_highlighting()

def grepros.outputs.ConsoleSink.is_highlighting (   self)
Returns True if sink is configured to highlight matched values.

Reimplemented from grepros.outputs.Sink.

Definition at line 585 of file outputs.py.

Member Data Documentation

◆ _prefix

grepros.outputs.ConsoleSink._prefix
private

Definition at line 566 of file outputs.py.

◆ CONTEXT_PREFIX_SEP

string grepros.outputs.ConsoleSink.CONTEXT_PREFIX_SEP = "-"
static

Definition at line 513 of file outputs.py.

◆ DEFAULT_ARGS

grepros.outputs.ConsoleSink.DEFAULT_ARGS
static
Initial value:
= dict(COLOR=True, EMIT_FIELD=(), NOEMIT_FIELD=(), HIGHLIGHT=True, META=False,
LINE_PREFIX=True, MAX_FIELD_LINES=None, START_LINE=None,
END_LINE=None, MAX_MESSAGE_LINES=None, LINES_AROUND_MATCH=None,
MATCHED_FIELDS_ONLY=False, WRAP_WIDTH=None, MATCH_WRAPPER=None)

Constructor argument defaults.

Definition at line 517 of file outputs.py.

◆ MATCH_PREFIX_SEP

string grepros.outputs.ConsoleSink.MATCH_PREFIX_SEP = ":"
static

Definition at line 512 of file outputs.py.

◆ MESSAGE_SEP_TEMPLATE

string grepros.outputs.ConsoleSink.MESSAGE_SEP_TEMPLATE = "{ll0}{sep}{ll1}"
static

Definition at line 510 of file outputs.py.

◆ META_LINE_TEMPLATE

string grepros.outputs.ConsoleSink.META_LINE_TEMPLATE = "{ll0}{sep} {line}{ll1}"
static

Definition at line 509 of file outputs.py.

◆ PREFIX_TEMPLATE

string grepros.outputs.ConsoleSink.PREFIX_TEMPLATE = "{pfx0}{batch}{pfx1}{sep0}{sep}{sep1}"
static

Definition at line 511 of file outputs.py.

◆ SEP

string grepros.outputs.ConsoleSink.SEP = "---"
static

Definition at line 514 of file outputs.py.


The documentation for this class was generated from the following file:


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:30