Python Forum
program to code: log results of a command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program to code: log results of a command
#1
i have done this in bash with a lot of trickery.  i have been thinking about re-doing this in Python.

what i would like to see written in Python is a command that can log the output of a command given at the of its arguments.

it should name the log file like {prefix}-{yyyy}-{mm}-{dd}-{HH}-{MM}-{SS}-{uuuuuu}-{pppp}-{suffix}.log where ppppp is the process id and uuuuuu is the microsends of time.  the prefix is optional and provided in the -p option.  the suffix is optional and given by the -s option.  the file is stored in the home directory unless the -d option is given to store it elsewhere (with '../' not allowed anywhere in the middle of the name).  a config file can be consulted for preferred defaults at '.config/{name_of_logger_command}.conf' or somewhere like that.  the logger should exit with the same exit code as the command it is logging.  the logger should be implemented in a way that any characters or byte codes in any argument are passed to the command being logged without any change, or risk of any security aspect other than in the program being logged.

a plus: nanoseconds instead of microseconds, where available, such as in Linux since version 2.6

a plus: at the end of the command being logged, list files it created or modified contents of.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  want command program: sleep to a specific time Skaperen 3 3,565 Jul-11-2017, 01:33 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020