Differences
This shows you the differences between the selected revisions of the page.
| 2019-08-20 | 2019-11-19 | ||
| wording (martin) | error handling and logging (martin) | ||
| Line 12: | Line 12: | ||
| [TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log, ExecutionContext context) | [TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log, ExecutionContext context) | ||
| { | { | ||
| - | SessionOptions sessionOptions = new SessionOptions(); | + | try |
| - | // setup sessionOptions | + | |
| - | + | ||
| - | using (Session session = new Session()) | + | |
| { | { | ||
| - | // Look for winscp.exe in the root folder of the function | + | log.Info("Starting"); |
| - | ········session.ExecutablePath = Path.Combine(context.FunctionAppDirectory, "winscp.exe"); | + | ········SessionOptions sessionOptions = new SessionOptions(); |
| + | // setup sessionOptions | ||
| - | session.Open(sessionOptions); | + | using (Session session = new Session()) |
| - | ······· | + | { |
| - | ·······// ... | + | // Look for winscp.exe in the root folder of the function |
| + | session.ExecutablePath = Path.Combine(context.FunctionAppDirectory, "winscp.exe"); | ||
| + | |||
| + | log.Info("Connecting"); | ||
| + | ············session.Open(sessionOptions); | ||
| + | ··········· | ||
| + | ···········// ... | ||
| + | } | ||
| + | log.Info("Done"); | ||
| + | } | ||
| + | catch (Exception e) | ||
| + | { | ||
| + | log.Error("Error", e); | ||
| } | } | ||
| } | } | ||