mirror of
https://github.com/actions/runner.git
synced 2025-12-12 05:37:01 +00:00
GitHub Actions Runner
This commit is contained in:
39
src/Runner.Common/RunnerService.cs
Normal file
39
src/Runner.Common/RunnerService.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace GitHub.Runner.Common
|
||||
{
|
||||
|
||||
[AttributeUsage(AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class ServiceLocatorAttribute : Attribute
|
||||
{
|
||||
public static readonly string DefaultPropertyName = "Default";
|
||||
|
||||
public Type Default { get; set; }
|
||||
}
|
||||
|
||||
public interface IRunnerService
|
||||
{
|
||||
void Initialize(IHostContext context);
|
||||
}
|
||||
|
||||
public abstract class RunnerService
|
||||
{
|
||||
protected IHostContext HostContext { get; private set; }
|
||||
protected Tracing Trace { get; private set; }
|
||||
|
||||
public string TraceName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetType().Name;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Initialize(IHostContext hostContext)
|
||||
{
|
||||
HostContext = hostContext;
|
||||
Trace = HostContext.GetTrace(TraceName);
|
||||
Trace.Entering();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user