forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ConsoleLogger.cs
42 lines (36 loc) · 1.55 KB
/
ConsoleLogger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using Microsoft.Xna.Framework.Content.Pipeline;
namespace MonoGame.Content.Builder
{
public class ConsoleLogger : ContentBuildLogger
{
public override void LogMessage(string message, params object[] messageArgs)
{
Console.WriteLine(IndentString + message, messageArgs);
}
public override void LogImportantMessage(string message, params object[] messageArgs)
{
// TODO: How do i make it high importance?
Console.WriteLine(IndentString + message, messageArgs);
}
public override void LogWarning(string helpLink, ContentIdentity contentIdentity, string message, params object[] messageArgs)
{
var warning = string.Empty;
if (contentIdentity != null && !string.IsNullOrEmpty(contentIdentity.SourceFilename))
{
warning = contentIdentity.SourceFilename;
if (!string.IsNullOrEmpty(contentIdentity.FragmentIdentifier))
warning += "(" + contentIdentity.FragmentIdentifier + ")";
warning += ": ";
}
if (messageArgs != null && messageArgs.Length != 0)
warning += string.Format(message, messageArgs);
else if (!string.IsNullOrEmpty(message))
warning += message;
Console.WriteLine(warning);
}
}
}