Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  format.py   Sprache: Python

 
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import argparse
import sys

from .. import commandline, handlers, reader


def get_parser(add_help=True):
    parser = argparse.ArgumentParser(
        "format", description="Format a structured log stream", add_help=add_help
    )
    parser.add_argument(
        "--input",
        action="store",
        default=None,
        help="Filename to read from, defaults to stdin",
    )
    parser.add_argument(
        "--output",
        action="store",
        default=None,
        help="Filename to write to, defaults to stdout",
    )
    parser.add_argument(
        "format", choices=list(commandline.log_formatters.keys()), help="Format to use"
    )
    return parser


def main(**kwargs):
    if kwargs["input"is None:
        input_file = sys.stdin
    else:
        input_file = open(kwargs["input"])
    if kwargs["output"is None:
        output_file = sys.stdout
    else:
        output_file = open(kwargs["output"], "w")

    formatter = commandline.log_formatters[kwargs["format"]][0]()

    handler = handlers.StreamHandler(stream=output_file, formatter=formatter)

    for data in reader.read(input_file):
        handler(data)


if __name__ == "__main__":
    parser = get_parser()
    args = parser.parse_args()
    kwargs = vars(args)
    main(**kwargs)

Messung V0.5
C=91 H=89 G=89

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge