fruafr.log package

Subpackages

Submodules

fruafr.log.logtoconsole module

CLI - Print a log message in the console

Can use: python3 logtoconsole.py [message] -L [level] &>> /tmp/log.log

to append it to the log file (/tmp/log.log is an example)

class fruafr.log.logtoconsole.Console[source]

Bases: object

Class Console Parses the command line arguments

parse_args(args) Namespace[source]

Parse the arguments from the command line :param args: the list of arguments from the command line :type args: list

Returns:

the argparse.Namespace object containing the parsed arguments

process(args: Namespace)[source]

Process the command line arguments :param args: Command line arguments :type args: argparser.Namespace

fruafr.log.logtoconsole.main()[source]

Main : CLI logic

fruafr.log.logtofile module

CLI - Save a log message to a log file

No output is written to the console by default (otherwise, use verbose)

class fruafr.log.logtofile.Console[source]

Bases: Console

Class Console Parses the command line arguments Extends/Replaces logtoconsole.Console

parse_args(args) Namespace[source]

Parse the arguments from the command line :param args: the list of arguments from the command line :type args: list

Returns:

the argparse.Namespace object containing the parsed arguments

process(args: Namespace)[source]

Process the command line arguments :param args: Command line arguments :type args: argparser.Namespace

fruafr.log.logtofile.main()[source]

Main : CLI logic

fruafr.log.logtosyslog module

CLI - Save a log message to a log file

No output is written to the console by default (otherwise, use verbose)

class fruafr.log.logtosyslog.Console[source]

Bases: Console

Class Console Parses the command line arguments Extends/Replaces logtoconsole.Console

parse_args(args) Namespace[source]

Parse the arguments from the command line :param args: the list of arguments from the command line :type args: list

Returns:

the argparse.Namespace object containing the parsed arguments

process(args: Namespace)[source]

Process the command line arguments :param args: Command line arguments :type args: argparser.Namespace

fruafr.log.logtosyslog.main()[source]

Main : CLI logic

fruafr.log.tinysyslogserver module

Tiny Syslog Server in Python.

This is a tiny syslog server that is able to receive syslog messages via both UDP and TCP. It saves the log messages to a file (specified with the -F –file option). It can display on the console using the –verbose (-v) option. It requires sudo permission to start the server. It uses two processes (one for UDP and one for TCP)

Originally inspired by: - by: https://gist.github.com/marcelom/4218010 (pysyslog.py for UDP) - by: https://stackoverflow.com/questions/61633410/how-do-i-accept-tcp-and-udp

(for UDP and TCP threading)

class fruafr.log.tinysyslogserver.Console[source]

Bases: Console

Class Console Extends logtoconsole.Console

parse_args(args) Namespace[source]

Parse the arguments from the command line :param args: the list of arguments from the command line :type args: list

Returns:

the argparse.Namespace object containing the parsed arguments

process(args: Namespace) set[source]

Process the command line arguments :param args: Command line arguments :type args: argparser.Namespace

Returns:

UDPServer, TCPserver

Return type:

set

class fruafr.log.tinysyslogserver.SyslogTCPHandler(request, client_address, server)[source]

Bases: BaseRequestHandler

Syslog TCP handler handles TCP requests

handle()[source]
class fruafr.log.tinysyslogserver.SyslogUDPHandler(request, client_address, server)[source]

Bases: BaseRequestHandler

Syslog UDP handler handles UDP requests

handle()[source]
fruafr.log.tinysyslogserver.main()[source]

Main : CLI logic

fruafr.log.tinysyslogserver.tcp_listen(server)[source]

Listen to tcp traffic

fruafr.log.tinysyslogserver.udp_listen(server)[source]

Listen to udp traffic

Module contents