Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to define logging level #6

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It is also helpful for local development to start multiple commands easily with

## Installation

Install the robmuxinator with one simple command
Install the robmuxinator with one simple command (execute in the `robmuxinator` package)
```
sudo pip install .
```
Expand Down Expand Up @@ -60,7 +60,7 @@ sessions:
host: localhost
prio: 1
command: echo 'starting bringup...'

```

To start the `tmux` sessions use `robmuxinator -c ~/path-to-file start`. Now, you are able to see your sessions with `tmux ls`
Expand Down Expand Up @@ -94,7 +94,7 @@ sessions:
host: h2
prio: 1
command: echo 'starting bringup...'

```
## Usage
### Command Choices
Expand Down
12 changes: 11 additions & 1 deletion robmuxinator/robmuxinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def format(self, record):
logging.addLevelName(logging.CRITICAL, "C")

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

custom_format = CustomFormatter()

Expand Down Expand Up @@ -750,13 +749,24 @@ def main():
action="store_true",
help="close sessions even if they are locked",
)
parser.add_argument(
"-l",
"--logging_level",
required=False,
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
default="INFO",
help="logging level",
)

argcomplete.autocomplete(parser)
args = parser.parse_args()
# parse arguments
yaml_file = args.config
command = args.command

# set logging level
logger.setLevel(level=args.logging_level)

# load yaml file
with open(yaml_file, "r") as fs:
yaml_content = yaml.safe_load(fs)
Expand Down