* example soft logger by delegate
parent
82d309d007
commit
2f072d1e10
|
@ -0,0 +1,85 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class Logger
|
||||||
|
{
|
||||||
|
public static Logger Instance = new Logger( false );
|
||||||
|
|
||||||
|
public delegate void LoggerMethodDelegate();
|
||||||
|
private delegate bool LoggerDelegate( LoggerMethodDelegate whatToDo );
|
||||||
|
|
||||||
|
|
||||||
|
private LoggerDelegate m_delegate;
|
||||||
|
|
||||||
|
public Logger( bool log )
|
||||||
|
{
|
||||||
|
if( log )
|
||||||
|
{
|
||||||
|
m_delegate = CatchAndLog;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_delegate = DontCatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Wrap( LoggerMethodDelegate whatToDo )
|
||||||
|
{
|
||||||
|
return m_delegate( whatToDo );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool CatchAndLog(LoggerMethodDelegate whatToDo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
whatToDo();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine( "Exception logged!!! Woah!!!!" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool DontCatch(LoggerMethodDelegate whatToDo)
|
||||||
|
{
|
||||||
|
whatToDo();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LoggerExample
|
||||||
|
{
|
||||||
|
public void TryWrap()
|
||||||
|
{
|
||||||
|
// This will log and ignore
|
||||||
|
Logger log = new Logger(true);
|
||||||
|
|
||||||
|
log.Wrap(delegate()
|
||||||
|
{
|
||||||
|
Int16.Parse("waa!");
|
||||||
|
});
|
||||||
|
|
||||||
|
// This will throw;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
log = new Logger(false);
|
||||||
|
|
||||||
|
log.Wrap(delegate()
|
||||||
|
{
|
||||||
|
Int16.Parse("waa!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Example barfed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,6 +102,9 @@
|
||||||
<Compile Include="IRegionCommsListener.cs">
|
<Compile Include="IRegionCommsListener.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Logger.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="LoginService.cs">
|
<Compile Include="LoginService.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<include name="AuthenticateSessionBase.cs" />
|
<include name="AuthenticateSessionBase.cs" />
|
||||||
<include name="BlockingQueue.cs" />
|
<include name="BlockingQueue.cs" />
|
||||||
<include name="IRegionCommsListener.cs" />
|
<include name="IRegionCommsListener.cs" />
|
||||||
|
<include name="Logger.cs" />
|
||||||
<include name="LoginService.cs" />
|
<include name="LoginService.cs" />
|
||||||
<include name="RegionCommsListener.cs" />
|
<include name="RegionCommsListener.cs" />
|
||||||
<include name="Remoting.cs" />
|
<include name="Remoting.cs" />
|
||||||
|
|
73
OpenSim.sln
73
OpenSim.sln
|
@ -1,5 +1,5 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual C# Express 2005
|
# Visual Studio 2005
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}"
|
||||||
|
@ -51,6 +51,77 @@ Global
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectDependencies) = postSolution
|
||||||
|
({683344D5-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).3 = ({683344D5-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).4 = ({1938EB12-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).7 = ({E88EF749-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).8 = ({79CED992-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).10 = ({196916AF-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).11 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).12 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).13 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||||
|
({438A9556-0000-0000-0000-000000000000}).16 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({1938EB12-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({8ACA2445-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({8ACA2445-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({E88EF749-0000-0000-0000-000000000000}).0 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({546099CD-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({546099CD-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({B55C0B5D-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({B55C0B5D-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({B55C0B5D-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({79CED992-0000-0000-0000-000000000000}).1 = ({683344D5-0000-0000-0000-000000000000})
|
||||||
|
({79CED992-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({4F874463-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({8BE16150-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({8BE16150-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({988F0AC4-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).3 = ({683344D5-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).4 = ({1938EB12-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).7 = ({E88EF749-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).8 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).10 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||||
|
({196916AF-0000-0000-0000-000000000000}).13 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).3 = ({1938EB12-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).6 = ({E88EF749-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).7 = ({8BE16150-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).8 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).9 = ({2270B8FE-0000-0000-0000-000000000000})
|
||||||
|
({632E1BFD-0000-0000-0000-000000000000}).12 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({8BB20F0A-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({8BB20F0A-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({EE9E5D96-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({EE9E5D96-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({E1B79ECF-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({E1B79ECF-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({6B20B603-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({6B20B603-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).1 = ({1938EB12-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).4 = ({546099CD-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).5 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).6 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||||
|
({24B12448-0000-0000-0000-000000000000}).10 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).1 = ({1938EB12-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).4 = ({546099CD-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).5 = ({632E1BFD-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).6 = ({8BB20F0A-0000-0000-0000-000000000000})
|
||||||
|
({24DF2448-0000-0000-0000-000000000000}).10 = ({8E81D43C-0000-0000-0000-000000000000})
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{683344D5-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\Sugilite\bin\</ReferencePath>
|
<ReferencePath>C:\Documents and Settings\Stefan\My Documents\source\opensim\branches\Sugilite\bin\</ReferencePath>
|
||||||
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
<ProjectTrust>0</ProjectTrust>
|
<ProjectTrust>0</ProjectTrust>
|
||||||
|
|
|
@ -12,13 +12,6 @@
|
||||||
<property name="build.debug" value="true" />
|
<property name="build.debug" value="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<property name="project.config" value="Release" />
|
|
||||||
|
|
||||||
<target name="Release" description="">
|
|
||||||
<property name="project.config" value="Release" />
|
|
||||||
<property name="build.debug" value="false" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="net-1.1" description="Sets framework to .NET 1.1">
|
<target name="net-1.1" description="Sets framework to .NET 1.1">
|
||||||
<property name="nant.settings.currentframework" value="net-1.1" />
|
<property name="nant.settings.currentframework" value="net-1.1" />
|
||||||
</target>
|
</target>
|
||||||
|
|
|
@ -5,13 +5,10 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Reference in New Issue