-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
133 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package fmesh | ||
|
||
import "log" | ||
|
||
const UnlimitedCycles = 0 | ||
|
||
type Config struct { | ||
// ErrorHandlingStrategy defines how f-mesh will handle errors and panics | ||
ErrorHandlingStrategy ErrorHandlingStrategy | ||
// CyclesLimit defines max number of activation cycles, 0 means no limit | ||
CyclesLimit int | ||
// Debug flag enabled debug mode, when additional information will be logged | ||
Debug bool | ||
Logger *log.Logger | ||
} | ||
|
||
var defaultConfig = &Config{ | ||
ErrorHandlingStrategy: StopOnFirstErrorOrPanic, | ||
CyclesLimit: 1000, | ||
Debug: false, | ||
Logger: getDefaultLogger(), | ||
} | ||
|
||
// withConfig sets the configuration and returns the f-mesh | ||
func (fm *FMesh) withConfig(config *Config) *FMesh { | ||
if fm.HasErr() { | ||
return fm | ||
} | ||
|
||
fm.config = config | ||
|
||
if fm.Logger() == nil { | ||
fm.config.Logger = getDefaultLogger() | ||
} | ||
return fm | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.