📄 logging.cs
字号:
/*
Copyright 2006 Christian Gross http://www.devspace.com
From the book Ajax Patterns and Best Practices
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
#if !LOGCONSOLE
//using log4net;
//[assembly: log4net.Config.DOMConfigurator(Watch=true)]
#endif
namespace Devspace.Commons {
#if LOGCONSOLE
public class Logging {
public static void Debug( string message) {
Console.Write( "Debug - " + message);
}
public static void Info( string message) {
Console.Write( "Info - " + message);
}
public static void Warn( string message) {
Console.Write( "Warn - " + message);
}
public static void Error( string message) {
Console.Write( "Error - " + message);
}
public static void Fatal( string message) {
Console.Write( "Fatal - " + message);
}
}
#elif LOGLOG4NET
public class Logging {
private static readonly ILog log = LogManager.GetLogger( "logger.log4net");
static void Debug( string message) {
if( log.IsDebugEnabled) {
log.Debug( message);
}
}
static void Info( string message) {
if( log.IsInfoEnabled) {
log.Info( message);
}
}
static void Warn( string message) {
if( log.IsWarnEnabled) {
log.Warn( message);
}
}
static void Error( string message) {
if( log.IsErrorEnabled) {
log.Error( message);
}
}
static void Fatal( string message) {
if( log.IsFatalEnabled) {
log.Fatal( message);
}
}
}
#else
public class Logging {
public static void Debug( string message) {
}
public static void Info( string message) {
}
public static void Warn( string message) {
}
public static void Error( string message) {
}
public static void Fatal( string message) {
}
}
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -