2017-07-05 11:41:19 +02:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2017-07-05 11:41:19 +02:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-07-07 15:46:32 +02:00
|
|
|
|
using System;
|
2017-07-05 17:21:52 +02:00
|
|
|
|
using System.Collections.Generic;
|
2019-09-06 09:39:28 +02:00
|
|
|
|
using SafeExamBrowser.Settings.Logging;
|
2017-07-05 17:21:52 +02:00
|
|
|
|
|
2019-08-30 09:55:26 +02:00
|
|
|
|
namespace SafeExamBrowser.Logging.Contracts
|
2017-07-05 11:41:19 +02:00
|
|
|
|
{
|
2018-03-06 11:38:12 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Defines the functionality of the logger.
|
|
|
|
|
/// </summary>
|
2017-07-06 18:18:39 +02:00
|
|
|
|
public interface ILogger
|
2017-07-05 11:41:19 +02:00
|
|
|
|
{
|
2019-01-23 08:12:15 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The currently active severity threshold. All messages with a lower severity won't be logged!
|
|
|
|
|
/// </summary>
|
|
|
|
|
LogLevel LogLevel { get; set; }
|
|
|
|
|
|
2018-01-23 15:33:54 +01:00
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Logs the given message with severity <see cref="LogLevel.Debug"/>.
|
2018-01-23 15:33:54 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
|
|
|
|
void Debug(string message);
|
|
|
|
|
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Logs the given message with severity <see cref="LogLevel.Info"/>.
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-06 18:18:39 +02:00
|
|
|
|
void Info(string message);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Logs the given message with severity <see cref="LogLevel.Warning"/>.
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-06 18:18:39 +02:00
|
|
|
|
void Warn(string message);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Logs the given message with severity <see cref="LogLevel.Error"/>.
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-06 18:18:39 +02:00
|
|
|
|
void Error(string message);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Logs the given message with severity <see cref="LogLevel.Error"/> and includes
|
|
|
|
|
/// information about the specified exception (i.e. type, message and stacktrace).
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-07 15:46:32 +02:00
|
|
|
|
void Error(string message, Exception exception);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logs the given message as raw text.
|
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-07 15:46:32 +02:00
|
|
|
|
void Log(string message);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-08-31 07:49:41 +02:00
|
|
|
|
/// Subscribes an observer to the application log.
|
2017-07-12 15:36:30 +02:00
|
|
|
|
/// </summary>
|
2017-10-10 15:44:04 +02:00
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
2017-07-06 18:18:39 +02:00
|
|
|
|
void Subscribe(ILogObserver observer);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Unsubscribes an observer from the application log.
|
|
|
|
|
/// </summary>
|
2017-07-06 18:18:39 +02:00
|
|
|
|
void Unsubscribe(ILogObserver observer);
|
2017-07-12 15:36:30 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns a copy of the current log content.
|
|
|
|
|
/// </summary>
|
2017-07-07 15:46:32 +02:00
|
|
|
|
IList<ILogContent> GetLog();
|
2017-07-05 11:41:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|