CydinBuildService.BuildContext.Log C# (CSharp) Method

Log() public method

public Log ( Exception ex ) : void
ex System.Exception
return void
        public void Log(Exception ex)
        {
            string txt = "Error [" + DateTime.Now.ToLongTimeString () + "] " + ex.ToString ();
            LogService.WriteLine (txt);
            Server.Log (LogSeverity.Error, ex.ToString ());
        }

Same methods

BuildContext::Log ( LogSeverity severity, string message ) : void

Usage Example

Example #1
0
 void PushFiles(BuildContext ctx, SourceInfo source, SourceTagInfo stag, bool safe)
 {
     try {
         ctx.Status = "Uploading files for project " + source.ProjectName;
         foreach (string file in Directory.GetFiles(stag.GetPackagePath(ctx)))
         {
             ctx.Log(LogSeverity.Info, "Uploading [" + source.ProjectName + "] " + Path.GetFileName(file));
             WebRequest req = HttpWebRequest.Create(ctx.ServerUrl + "/package/upload");
             req.Headers ["applicationId"] = ctx.AppId.ToString();
             req.Headers ["sourceTagId"]   = stag.Id.ToString();
             req.Headers ["fileName"]      = Path.GetFileName(file);
             req.Method = "POST";
             req.GetRequestStream().WriteFile(file);
             using (StreamReader s = new StreamReader(req.GetResponse().GetResponseStream())) {
                 if (s.ReadToEnd() != "OK")
                 {
                     throw new Exception("File upload failed");
                 }
             }
         }
     } catch {
         if (!safe)
         {
             throw;
         }
     }
     finally {
         ctx.Status = "Files uploaded";
     }
 }
All Usage Examples Of CydinBuildService.BuildContext::Log