-
Notifications
You must be signed in to change notification settings - Fork 2
Logging
Gurmit Teotia edited this page Jan 3, 2020
·
4 revisions
Guflow has in built basic mechanism to generate the logs and it does not rely on third party library to generate the logs. However you can use any third party library to generate the log out of Guflow.
To enable the logging in Guflow you need to register the logger in the beginning of your program as shown in following example:
private static async Task MainAsync(string []args)
{
//It will cause the Guflow log messages to be send to console.
Log.Register(Log.ConsoleLogger);
...
}
Built-in loggers: Guflow supports following built-in loggers:
- Log.ConsoleLogger: It will send the log message to console.
- Log.NullLogger: No log messages are generated.
Custom logger: To use the custom/third party logger for Gulow you need to derive a class from Guflow.ILog as shown in following example:
class CustomLog : ILog
{
private readonly string _typeName;
private ILogger _custom; //It can be third party logger.
public ConsoleLog(string typeName)
{
//some third party logger e.g. Log4Net
_custom = LogManger.GetLogger(typeName);
_typeName = typeName;
}
public void Info(string message)
{
_custom.Info(message);
}
public void Info(string message, Exception exception)
{
_custom.Info(message, exception);
}
public void Debug(string message)
{
_custom.Debug(message, exception);
}
.....
}
and register it with Guflow to be used:
Log.Register(type=>new CustomLog(type.Name));
Guflow
- Prerequisite
- Installation
-
Workflows
- Creating first workflow
- Registration
- Hosting
- Start workflow
- Schedule activities
- Schedule timers
- Schedule lambda function
- Schedule child workflows
- Lambda functions vs activities
- Workflow input
- Workflow actions
- Signals
- Workflow branches
- Deflow algorithm
- Workflow events
- Query APIs
- Custom polling strategy
- Things to take care of
- Activites
- Unit testing
- Performance & scalability
- Error handling
- Logging
- Debugging
- Tutorial
- Release notes