mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 14:19:57 +00:00
TUN-3198: Handle errors while running tunnel UI
This commit is contained in:

committed by
Areg Harutyunyan

parent
8a829b773a
commit
26fc20d406
@@ -85,6 +85,14 @@ func LogLevelString(level string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func GetSupportedLevels(level string) ([]Level, error) {
|
||||
supported, err := ParseLevelString(level)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return supported, nil
|
||||
}
|
||||
|
||||
// Parse builds the Options struct so the caller knows what actions should be run
|
||||
func Parse(opts ...Option) (*Options, error) {
|
||||
options := &Options{}
|
||||
@@ -98,7 +106,7 @@ func Parse(opts ...Option) (*Options, error) {
|
||||
|
||||
// New setups a new logger based on the options.
|
||||
// The default behavior is to write to standard out
|
||||
func New(opts ...Option) (Service, error) {
|
||||
func New(opts ...Option) (*OutputWriter, error) {
|
||||
config, err := Parse(opts...)
|
||||
|
||||
if err != nil {
|
||||
@@ -123,6 +131,7 @@ func New(opts ...Option) (Service, error) {
|
||||
l.Add(os.Stderr, terminalFormatter, config.supportedTerminalLevels...)
|
||||
}
|
||||
}
|
||||
|
||||
return l, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user