blob: a7513f8d0acba2a2b4944464e61e39c9c46731e5 [file] [log] [blame]
#!/bin/bash
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### Listen for logs
## usage: fx syslog [-d|--device <device>] [log-listener flags]
##
## Creates an SSH connection with a device and starts listening for logs.
## Pass -h to get help with log-listener flags.
##
## Arguments:
## -d|--device Fuchsia link-local name of the device. If not
## specified, will connect to the only available
## device on the link-local network.
set -e
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
case $1 in
-d|--device)
shift # name
if [[ -z "$1" ]]; then
echo "Missing parameter: <device>" >&2
fx-command-help
exit 1
fi
device="$1"
shift # value
;;
esac
fx-command-exec ssh "$(fx-command-run netaddr --fuchsia "${device}")" /system/bin/log_listener "$@"