diff --git a/Source/ACE.Server/Command/Handlers/DeveloperCommands.cs b/Source/ACE.Server/Command/Handlers/DeveloperCommands.cs index 26394fe40a..83602e7c12 100644 --- a/Source/ACE.Server/Command/Handlers/DeveloperCommands.cs +++ b/Source/ACE.Server/Command/Handlers/DeveloperCommands.cs @@ -2246,7 +2246,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param if (value.ObjMaint.RemoveKnownObject(kvp.Value, false)) { if (log.IsDebugEnabled) - log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [ObjectTable]"); + log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [ObjectTable]"); objectTableErrors++; } } @@ -2259,7 +2259,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param if (value.ObjMaint.RemoveVisibleObject(kvp.Value, false)) { if (log.IsDebugEnabled) - log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VisibleObjectTable]"); + log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VisibleObjectTable]"); visibleObjectTableErrors++; } } @@ -2272,7 +2272,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param if (value.ObjMaint.RemoveKnownPlayer(kvp.Value)) { if (log.IsDebugEnabled) - log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VoyeurTable]"); + log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VoyeurTable]"); voyeurTableErrors++; } } diff --git a/Source/ACE.Server/Entity/GeneratorProfile.cs b/Source/ACE.Server/Entity/GeneratorProfile.cs index 09f3450569..82f35433af 100644 --- a/Source/ACE.Server/Entity/GeneratorProfile.cs +++ b/Source/ACE.Server/Entity/GeneratorProfile.cs @@ -176,7 +176,7 @@ public void Enqueue(int numObjects = 1) { /*if (MaxObjectsSpawned) { - log.DebugFormat($"{_generator.Name}.Enqueue({numObjects}): max objects reached"); + log.DebugFormat("{0}.Enqueue({1}): max objects reached", _generator.Name, numObjects); break; }*/ SpawnQueue.Add(GetSpawnTime()); @@ -275,7 +275,7 @@ public List Spawn() foreach (var obj in objects) { - //log.DebugFormat($"{_generator.Name}.Spawn({obj.Name})"); + //log.DebugFormat("{0}.Spawn({1})", _generator.Name, obj.Name); obj.Generator = Generator; obj.GeneratorId = Generator.Guid.Full; @@ -306,7 +306,7 @@ public List Spawn() if (!success) { if (log.IsDebugEnabled) - log.DebugFormat($"[GENERATOR] 0x{Generator.Guid}:{Generator.WeenieClassId} {Generator.Name}.Spawn(): failed to spawn {obj.Name} (0x{obj.Guid}:{obj.WeenieClassId}) from profile {LinkId} at {RegenLocationType}{(obj.Location != null ? $"\n Gen LOC: {Generator.Location?.ToLOCString()}\n Obj LOC: {obj.Location.ToLOCString()}" : "")}"); + log.Debug($"[GENERATOR] 0x{Generator.Guid}:{Generator.WeenieClassId} {Generator.Name}.Spawn(): failed to spawn {obj.Name} (0x{obj.Guid}:{obj.WeenieClassId}) from profile {LinkId} at {RegenLocationType}{(obj.Location != null ? $"\n Gen LOC: {Generator.Location?.ToLOCString()}\n Obj LOC: {obj.Location.ToLOCString()}" : "")}"); obj.Destroy(); } } @@ -418,7 +418,7 @@ public bool Spawn_Shop(WorldObject obj) public bool Spawn_Default(WorldObject obj) { // default location handler? - //log.DebugFormat($"{_generator.Name}.Spawn_Default({obj.Name}): default handler for RegenLocationType {RegenLocationType}"); + //log.DebugFormat("{0}.Spawn_Default({1}): default handler for RegenLocationType {2}", _generator.Name, obj.Name, RegenLocationType); obj.Location = new ACE.Entity.Position(Generator.Location); @@ -429,7 +429,7 @@ public bool VerifyLandblock(WorldObject obj) { if (obj.Location == null || obj.Location.Landblock != Generator.Location.Landblock) { - //log.DebugFormat($"{_generator.Name}.VerifyLandblock({obj.Name}) - spawn location is invalid landblock"); + //log.DebugFormat("{0}.VerifyLandblock({1}) - spawn location is invalid landblock", _generator.Name, obj.Name); return false; } return true; @@ -439,7 +439,7 @@ public bool VerifyWalkableSlope(WorldObject obj) { if (!obj.Location.Indoors && !obj.Location.IsWalkable() && !VerifyWalkableSlopeExcludedLandblocks.Contains(obj.Location.LandblockId.Landblock)) { - //log.DebugFormat($"{_generator.Name}.VerifyWalkableSlope({obj.Name}) - spawn location is unwalkable slope"); + //log.DebugFormat("{0}.VerifyWalkableSlope({1}) - spawn location is unwalkable slope", _generator.Name, obj.Name); return false; } return true; @@ -470,7 +470,7 @@ public List TreasureGenerator() if (deathTreasure != null) { // TODO: get randomly generated death treasure from LootGenerationFactory - //log.DebugFormat($"{_generator.Name}.TreasureGenerator(): found death treasure {Biota.WeenieClassId}"); + //log.DebugFormat("{0}.TreasureGenerator(): found death treasure {1}", _generator.Name, Biota.WeenieClassId); return LootGenerationFactory.CreateRandomLootObjects(deathTreasure); } else @@ -479,7 +479,7 @@ public List TreasureGenerator() if (wieldedTreasure != null) { // TODO: get randomly generated wielded treasure from LootGenerationFactory - //log.DebugFormat($"{_generator.Name}.TreasureGenerator(): found wielded treasure {Biota.WeenieClassId}"); + //log.DebugFormat("{0}.TreasureGenerator(): found wielded treasure {1}", _generator.Name, Biota.WeenieClassId); // roll into the wielded treasure table //var table = new TreasureWieldedTable(wieldedTreasure); @@ -525,7 +525,7 @@ public void RemoveTreasure() /// public void NotifyGenerator(ObjectGuid target, RegenerationType eventType) { - //log.DebugFormat($"{_generator.Name}.NotifyGenerator({target:X8}, {eventType})"); + //log.DebugFormat("{0}.NotifyGenerator({1:X8}, {2})", _generator.Name, target, eventType); Spawned.TryGetValue(target.Full, out var woi); diff --git a/Source/ACE.Server/Entity/Landblock.cs b/Source/ACE.Server/Entity/Landblock.cs index 244bbb3779..f192a5f1df 100644 --- a/Source/ACE.Server/Entity/Landblock.cs +++ b/Source/ACE.Server/Entity/Landblock.cs @@ -167,7 +167,7 @@ public EnvironChangeType FogColor public Landblock(LandblockId id) { - //log.DebugFormat($"Landblock({(id.Raw | 0xFFFF):X8})"); + //log.DebugFormat("Landblock({0:X8})", (id.Raw | 0xFFFF)); Id = id; @@ -866,11 +866,15 @@ private bool AddWorldObjectInternal(WorldObject wo) if (wo.Generator != null) { - log.DebugFormat($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()} from generator {wo.Generator.WeenieClassId} - 0x{wo.Generator.Guid}:{wo.Generator.Name}"); + if (log.IsDebugEnabled) + log.Debug($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()} from generator {wo.Generator.WeenieClassId} - 0x{wo.Generator.Guid}:{wo.Generator.Name}"); wo.NotifyOfEvent(RegenerationType.PickUp); // Notify generator the generated object is effectively destroyed, use Pickup to catch both cases. } else if (wo.IsGenerator) // Some generators will fail random spawns if they're circumference spans over water or cliff edges - log.DebugFormat($"AddWorldObjectInternal: couldn't spawn generator 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}"); + { + if (log.IsDebugEnabled) + log.Debug($"AddWorldObjectInternal: couldn't spawn generator 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}"); + } else if (wo.ProjectileTarget == null && !(wo is SpellProjectile)) log.Warn($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}"); @@ -1118,7 +1122,7 @@ public void Unload() { var landblockID = Id.Raw | 0xFFFF; - //log.DebugFormat($"Landblock.Unload({landblockID:X8})"); + //log.DebugFormat("Landblock.Unload({0:X8})", landblockID); ProcessPendingWorldObjectAdditionsAndRemovals(); diff --git a/Source/ACE.Server/Managers/EventManager.cs b/Source/ACE.Server/Managers/EventManager.cs index 9a6cd28179..ea22a846e9 100644 --- a/Source/ACE.Server/Managers/EventManager.cs +++ b/Source/ACE.Server/Managers/EventManager.cs @@ -61,7 +61,7 @@ public static bool StartEvent(string e, WorldObject source, WorldObject target) } if (log.IsDebugEnabled) - log.DebugFormat($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} started an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been started.") : "")}"); + log.Debug($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} started an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been started.") : "")}"); return true; } @@ -90,7 +90,7 @@ public static bool StopEvent(string e, WorldObject source, WorldObject target) } if (log.IsDebugEnabled) - log.DebugFormat($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} stopped an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been stopped.") : "")}"); + log.Debug($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} stopped an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been stopped.") : "")}"); return true; } diff --git a/Source/ACE.Server/Managers/HouseManager.cs b/Source/ACE.Server/Managers/HouseManager.cs index 1320360803..d218fdc548 100644 --- a/Source/ACE.Server/Managers/HouseManager.cs +++ b/Source/ACE.Server/Managers/HouseManager.cs @@ -554,7 +554,7 @@ private static bool IsRentPaid(PlayerHouse playerHouse) if (rentItem.Paid < rentItem.Num) { if (log.IsDebugEnabled) - log.DebugFormat($"[HOUSE] {playerHouse.PlayerName}.IsRentPaid() - required {rentItem.Num:N0}x {(rentItem.Num > 1 ? $"{rentItem.PluralName}" : $"{rentItem.Name}")} ({rentItem.WeenieID}), found {rentItem.Paid:N0}"); + log.Debug($"[HOUSE] {playerHouse.PlayerName}.IsRentPaid() - required {rentItem.Num:N0}x {(rentItem.Num > 1 ? $"{rentItem.PluralName}" : $"{rentItem.Name}")} ({rentItem.WeenieID}), found {rentItem.Paid:N0}"); return false; } } diff --git a/Source/ACE.Server/Managers/LandblockManager.cs b/Source/ACE.Server/Managers/LandblockManager.cs index d6fa524622..d594d93c58 100644 --- a/Source/ACE.Server/Managers/LandblockManager.cs +++ b/Source/ACE.Server/Managers/LandblockManager.cs @@ -621,7 +621,7 @@ private static void UnloadLandblocks() swTrySplitEach.Stop(); if (swTrySplitEach.Elapsed.TotalMilliseconds > 3) - log.Warn($"[LANDBLOCK GROUP] TrySplit for {landblockGroups[i]} took: {swTrySplitEach.Elapsed.TotalMilliseconds:N2} ms"); + log.WarnFormat("[LANDBLOCK GROUP] TrySplit for {0} took: {1:N2} ms", landblockGroups[i], swTrySplitEach.Elapsed.TotalMilliseconds); else if (swTrySplitEach.Elapsed.TotalMilliseconds > 1) log.DebugFormat("[LANDBLOCK GROUP] TrySplit for {0} took: {1:N2} ms", landblockGroups[i], swTrySplitEach.Elapsed.TotalMilliseconds); diff --git a/Source/ACE.Server/Managers/RecipeManager.cs b/Source/ACE.Server/Managers/RecipeManager.cs index dd5e89b82c..bec6e99651 100644 --- a/Source/ACE.Server/Managers/RecipeManager.cs +++ b/Source/ACE.Server/Managers/RecipeManager.cs @@ -1069,7 +1069,7 @@ public static HashSet CreateDestroyItems(Player player, Recipe recipe, Wor player.Session.Network.EnqueueSend(new GameMessageSystemChat(message, ChatMessageType.Craft)); if (log.IsDebugEnabled) - log.DebugFormat($"[CRAFTING] {player.Name} used {source.NameWithMaterial} on {target.NameWithMaterial} {(success ? "" : "un")}successfully. {(destroySource ? $"| {source.NameWithMaterial} was destroyed " : "")}{(destroyTarget ? $"| {target.NameWithMaterial} was destroyed " : "")}| {message}"); + log.Debug($"[CRAFTING] {player.Name} used {source.NameWithMaterial} on {target.NameWithMaterial} {(success ? "" : "un")}successfully. {(destroySource ? $"| {source.NameWithMaterial} was destroyed " : "")}{(destroyTarget ? $"| {target.NameWithMaterial} was destroyed " : "")}| {message}"); } else BroadcastTinkering(player, source, target, successChance, success); @@ -1088,7 +1088,7 @@ public static void BroadcastTinkering(Player player, WorldObject tool, WorldObje player.EnqueueBroadcast(new GameMessageSystemChat($"{player.Name} fails to apply the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}. The target is destroyed.", ChatMessageType.Craft), WorldObject.LocalBroadcastRange, ChatMessageType.Craft); if (log.IsDebugEnabled) - log.DebugFormat($"[TINKERING] {player.Name} {(success ? "successfully applies" : "fails to apply")} the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}.{(!success ? " The target is destroyed." : "")} | Chance: {chance}"); + log.Debug($"[TINKERING] {player.Name} {(success ? "successfully applies" : "fails to apply")} the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}.{(!success ? " The target is destroyed." : "")} | Chance: {chance}"); } public static WorldObject CreateItem(Player player, uint wcid, uint amount) diff --git a/Source/ACE.Server/Managers/ServerManager.cs b/Source/ACE.Server/Managers/ServerManager.cs index 2a49e6dfca..2297bb80de 100644 --- a/Source/ACE.Server/Managers/ServerManager.cs +++ b/Source/ACE.Server/Managers/ServerManager.cs @@ -149,10 +149,10 @@ private static void ShutdownServer() if (playerCount > 0 && DateTime.UtcNow - playerLogoffStart > TimeSpan.FromMinutes(5)) { playerLogoffStart = DateTime.UtcNow; - log.Warn($"5 minute log off failsafe reached and there are {playerCount} player{(playerCount > 1 ? "s" : "")} still online."); + log.WarnFormat("5 minute log off failsafe reached and there are {0} player{1} still online.", playerCount, (playerCount > 1 ? "s" : "")); foreach (var player in PlayerManager.GetAllOnline()) { - log.Warn($"Player {player.Name} (0x{player.Guid}) appears to be stuck in world and unable to log off normally. Requesting Forced Logoff..."); + log.WarnFormat("Player {0} (0x{1}) appears to be stuck in world and unable to log off normally. Requesting Forced Logoff...", player.Name, player.Guid); player.ForcedLogOffRequested = true; player.ForceLogoff(); } diff --git a/Source/ACE.Server/Network/NetworkSession.cs b/Source/ACE.Server/Network/NetworkSession.cs index e0c5a3845a..69d623a938 100644 --- a/Source/ACE.Server/Network/NetworkSession.cs +++ b/Source/ACE.Server/Network/NetworkSession.cs @@ -146,7 +146,8 @@ public void EnqueueSend(params ServerPacket[] packets) foreach (var packet in packets) { - packetLog.DebugFormat("[{0}] Enqueuing Packet {1}", session.LoggingIdentifier, packet.GetHashCode()); + if (packetLog.IsDebugEnabled) + packetLog.DebugFormat("[{0}] Enqueuing Packet {1}", session.LoggingIdentifier, packet.GetHashCode()); packetQueue.Enqueue(packet); } } @@ -396,7 +397,8 @@ private void DoRequestForRetransmission(uint rcvdSeq) EnqueueSend(reqPacket); LastRequestForRetransmitTime = DateTime.UtcNow; - packetLog.DebugFormat("[{0}] Requested retransmit of {1}", session.LoggingIdentifier, needSeq.Select(k => k.ToString()).Aggregate((a, b) => a + ", " + b)); + if (packetLog.IsDebugEnabled) + packetLog.DebugFormat("[{0}] Requested retransmit of {1}", session.LoggingIdentifier, needSeq.Select(k => k.ToString()).Aggregate((a, b) => a + ", " + b)); NetworkStatistics.S2C_RequestsForRetransmit_Aggregate_Increment(); } @@ -708,13 +710,15 @@ private void FlushPackets() private void SendPacket(ServerPacket packet) { - packetLog.DebugFormat("[{0}] Sending packet {1}", session.LoggingIdentifier, packet.GetHashCode()); + if (packetLog.IsDebugEnabled) + packetLog.DebugFormat("[{0}] Sending packet {1}", session.LoggingIdentifier, packet.GetHashCode()); NetworkStatistics.S2C_Packets_Aggregate_Increment(); if (packet.Header.HasFlag(PacketHeaderFlags.EncryptedChecksum)) { uint issacXor = ConnectionData.IssacServer.Next(); - packetLog.DebugFormat("[{0}] Setting Issac for packet {1} to {2}", session.LoggingIdentifier, packet.GetHashCode(), issacXor); + if (packetLog.IsDebugEnabled) + packetLog.DebugFormat("[{0}] Setting Issac for packet {1} to {2}", session.LoggingIdentifier, packet.GetHashCode(), issacXor); packet.IssacXor = issacXor; } diff --git a/Source/ACE.Server/WorldObjects/Corpse.cs b/Source/ACE.Server/WorldObjects/Corpse.cs index 3688505c8c..154a69e5d2 100644 --- a/Source/ACE.Server/WorldObjects/Corpse.cs +++ b/Source/ACE.Server/WorldObjects/Corpse.cs @@ -71,7 +71,7 @@ protected override void OnInitialInventoryLoadCompleted() var tsDecay = dtTimeToRot - DateTime.UtcNow; if (log.IsDebugEnabled) - log.DebugFormat($"[CORPSE] {Name} (0x{Guid}) Reloaded from Database: Corpse Level: {Level ?? 0} | InventoryLoaded: {InventoryLoaded} | Inventory.Count: {Inventory.Count} | TimeToRot: {TimeToRot} | CreationTimestamp: {CreationTimestamp} ({Time.GetDateTimeFromTimestamp(CreationTimestamp ?? 0).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}) | Corpse should not decay before: {dtTimeToRot.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}, {tsDecay.ToString("%d")} day(s), {tsDecay.ToString("%h")} hours, {tsDecay.ToString("%m")} minutes, and {tsDecay.ToString("%s")} seconds from now."); + log.Debug($"[CORPSE] {Name} (0x{Guid}) Reloaded from Database: Corpse Level: {Level ?? 0} | InventoryLoaded: {InventoryLoaded} | Inventory.Count: {Inventory.Count} | TimeToRot: {TimeToRot} | CreationTimestamp: {CreationTimestamp} ({Time.GetDateTimeFromTimestamp(CreationTimestamp ?? 0).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}) | Corpse should not decay before: {dtTimeToRot.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}, {tsDecay.ToString("%d")} day(s), {tsDecay.ToString("%h")} hours, {tsDecay.ToString("%m")} minutes, and {tsDecay.ToString("%s")} seconds from now."); } } @@ -116,7 +116,7 @@ public void RecalculateDecayTime(Player player) Level = player.Level ?? 1; if (log.IsDebugEnabled) - log.DebugFormat($"[CORPSE] {Name}.RecalculateDecayTime({player.Name}) 0x{Guid}: Player Level: {player.Level} | Inventory.Count: {Inventory.Count} | TimeToRot: {TimeToRot} | CreationTimestamp: {CreationTimestamp} ({Time.GetDateTimeFromTimestamp(CreationTimestamp ?? 0).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}) | Corpse should not decay before: {dtTimeToRot.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}, {tsDecay.ToString("%d")} day(s), {tsDecay.ToString("%h")} hours, {tsDecay.ToString("%m")} minutes, and {tsDecay.ToString("%s")} seconds from now."); + log.Debug($"[CORPSE] {Name}.RecalculateDecayTime({player.Name}) 0x{Guid}: Player Level: {player.Level} | Inventory.Count: {Inventory.Count} | TimeToRot: {TimeToRot} | CreationTimestamp: {CreationTimestamp} ({Time.GetDateTimeFromTimestamp(CreationTimestamp ?? 0).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}) | Corpse should not decay before: {dtTimeToRot.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}, {tsDecay.ToString("%d")} day(s), {tsDecay.ToString("%h")} hours, {tsDecay.ToString("%m")} minutes, and {tsDecay.ToString("%s")} seconds from now."); } /// @@ -348,8 +348,8 @@ public void TryGenerateRare(DamageHistoryInfo killer) if (log.IsDebugEnabled) { - log.DebugFormat($"[LOOT][RARE] {Name} ({Guid}) generated rare {wo.Name} ({wo.Guid}) for {killer.Name} ({killer.Guid})"); - log.DebugFormat($"[LOOT][RARE] Tier {tier} -- 1 / {chance:N0} chance -- {luck:N0} luck"); + log.Debug($"[LOOT][RARE] {Name} ({Guid}) generated rare {wo.Name} ({wo.Guid}) for {killer.Name} ({killer.Guid})"); + log.Debug($"[LOOT][RARE] Tier {tier} -- 1 / {chance:N0} chance -- {luck:N0} luck"); } if (TryAddToInventory(wo)) diff --git a/Source/ACE.Server/WorldObjects/Creature.cs b/Source/ACE.Server/WorldObjects/Creature.cs index 8a0deddaa4..de07d65b88 100644 --- a/Source/ACE.Server/WorldObjects/Creature.cs +++ b/Source/ACE.Server/WorldObjects/Creature.cs @@ -33,7 +33,7 @@ public QuestManager QuestManager if (_questManager == null) { /*if (!(this is Player)) - log.DebugFormat($"Initializing non-player QuestManager for {Name} (0x{Guid})");*/ + log.DebugFormat("Initializing non-player QuestManager for {0} (0x{1})", Name, Guid);*/ _questManager = new QuestManager(this); } @@ -165,7 +165,7 @@ public void GenerateNewFace() { #if DEBUG //if (!(NpcLooksLikeObject ?? false)) - //log.DebugFormat($"Creature.GenerateNewFace: {Name} (0x{Guid}) - wcid {WeenieClassId} - Heritage: {Heritage} | HeritageGroupName: {HeritageGroupName} | Gender: {Gender} | Sex: {Sex} - Data missing or unparsable, Cannot randomize face."); + //log.DebugFormat("Creature.GenerateNewFace: {0} (0x{1}) - wcid {2} - Heritage: {3} | HeritageGroupName: {4} | Gender: {5} | Sex: {6} - Data missing or unparsable, Cannot randomize face.", Name, Guid, WeenieClassId, Heritage, HeritageGroupName, Gender, Sex); #endif return; } @@ -173,7 +173,7 @@ public void GenerateNewFace() if (!cg.HeritageGroups.TryGetValue((uint)Heritage, out var heritageGroup) || !heritageGroup.Genders.TryGetValue((int)Gender, out var sex)) { #if DEBUG - log.DebugFormat($"Creature.GenerateNewFace: {Name} (0x{Guid}) - wcid {WeenieClassId} - Heritage: {Heritage} | HeritageGroupName: {HeritageGroupName} | Gender: {Gender} | Sex: {Sex} - Data invalid, Cannot randomize face."); + log.DebugFormat("Creature.GenerateNewFace: {0} (0x{1}) - wcid {2} - Heritage: {3} | HeritageGroupName: {4} | Gender: {5} | Sex: {6} - Data invalid, Cannot randomize face.", Name, Guid, WeenieClassId, Heritage, HeritageGroupName, Gender, Sex); #endif return; } diff --git a/Source/ACE.Server/WorldObjects/Creature_Death.cs b/Source/ACE.Server/WorldObjects/Creature_Death.cs index b6416573a8..790603de48 100644 --- a/Source/ACE.Server/WorldObjects/Creature_Death.cs +++ b/Source/ACE.Server/WorldObjects/Creature_Death.cs @@ -617,7 +617,7 @@ protected void CreateCorpse(DamageHistoryInfo killer, bool hadVitae = false) corpse.EnterWorld(); - if (player != null) + if (player != null && log.IsDebugEnabled) { if (corpse.PhysicsObj == null || corpse.PhysicsObj.Position == null) log.DebugFormat("[CORPSE] {0}'s corpse (0x{1}) failed to spawn! Tried at {2}", Name, corpse.Guid, player.Location.ToLOCString()); @@ -730,10 +730,10 @@ public void DoCantripLogging(DamageHistoryInfo killer, WorldObject wo) var legendaryCantrips = wo.LegendaryCantrips; if (epicCantrips.Count > 0 && log.IsDebugEnabled) - log.DebugFormat($"[LOOT][EPIC] {Name} ({Guid}) generated item with {epicCantrips.Count} epic{(epicCantrips.Count > 1 ? "s" : "")} - {wo.Name} ({wo.Guid}) - {GetSpellList(epicCantrips)} - killed by {killer?.Name} ({killer?.Guid})"); + log.Debug($"[LOOT][EPIC] {Name} ({Guid}) generated item with {epicCantrips.Count} epic{(epicCantrips.Count > 1 ? "s" : "")} - {wo.Name} ({wo.Guid}) - {GetSpellList(epicCantrips)} - killed by {killer?.Name} ({killer?.Guid})"); if (legendaryCantrips.Count > 0 && log.IsDebugEnabled) - log.DebugFormat($"[LOOT][LEGENDARY] {Name} ({Guid}) generated item with {legendaryCantrips.Count} legendar{(legendaryCantrips.Count > 1 ? "ies" : "y")} - {wo.Name} ({wo.Guid}) - {GetSpellList(legendaryCantrips)} - killed by {killer?.Name} ({killer?.Guid})"); + log.Debug($"[LOOT][LEGENDARY] {Name} ({Guid}) generated item with {legendaryCantrips.Count} legendar{(legendaryCantrips.Count > 1 ? "ies" : "y")} - {wo.Name} ({wo.Guid}) - {GetSpellList(legendaryCantrips)} - killed by {killer?.Name} ({killer?.Guid})"); } public static string GetSpellList(Dictionary spellTable) diff --git a/Source/ACE.Server/WorldObjects/Player.cs b/Source/ACE.Server/WorldObjects/Player.cs index 2b05c2f70a..01c299279f 100644 --- a/Source/ACE.Server/WorldObjects/Player.cs +++ b/Source/ACE.Server/WorldObjects/Player.cs @@ -265,7 +265,7 @@ public void HandleActionIdentifyObject(uint objectGuid) if (wo == null) { - //log.DebugFormat($"{Name}.HandleActionIdentifyObject({objectGuid:X8}): couldn't find object"); + //log.DebugFormat("{0}.HandleActionIdentifyObject({1:X8}): couldn't find object", Name, objectGuid); Session.Network.EnqueueSend(new GameEventIdentifyObjectResponse(Session, objectGuid)); return; } @@ -687,7 +687,7 @@ public void HandleActionForceObjDescSend(uint itemGuid) var wo = FindObject(itemGuid, SearchLocations.Everywhere); if (wo == null) { - //log.DebugFormat($"HandleActionForceObjDescSend() - couldn't find object {itemGuid:X8}"); + //log.DebugFormat("HandleActionForceObjDescSend() - couldn't find object {0:X8}", itemGuid); return; } Session.Network.EnqueueSend(new GameMessageObjDescEvent(wo)); diff --git a/Source/ACE.Server/WorldObjects/Player_Crafting.cs b/Source/ACE.Server/WorldObjects/Player_Crafting.cs index 3cfff04162..9819c3db3a 100644 --- a/Source/ACE.Server/WorldObjects/Player_Crafting.cs +++ b/Source/ACE.Server/WorldObjects/Player_Crafting.cs @@ -132,7 +132,7 @@ public void HandleSalvaging(List salvageItems) var item = GetInventoryItem(itemGuid); if (item == null) { - //log.DebugFormat($"[CRAFTING] {Name}.HandleSalvaging({itemGuid:X8}): couldn't find inventory item"); + //log.DebugFormat("[CRAFTING] {0}.HandleSalvaging({1:X8}): couldn't find inventory item", Name, itemGuid); continue; } diff --git a/Source/ACE.Server/WorldObjects/Player_House.cs b/Source/ACE.Server/WorldObjects/Player_House.cs index f6205676e3..aaaee3e478 100644 --- a/Source/ACE.Server/WorldObjects/Player_House.cs +++ b/Source/ACE.Server/WorldObjects/Player_House.cs @@ -442,7 +442,7 @@ public bool TrySplitItemForRent(SlumLord slumlord, WorldObject item, int amount) } if (log.IsDebugEnabled) - log.DebugFormat($"[HOUSE] {Name}.TrySplitItemForRent({slumlord.Name} ({slumlord.Guid}), {item.Name} ({item.Guid}), {amount}) - Created new item {((newItem.StackSize ?? 1) > 1 ? $"{newItem.StackSize}x " : "")}{newItem.Name} ({newItem.Guid}) and moved to Slumlord."); + log.Debug($"[HOUSE] {Name}.TrySplitItemForRent({slumlord.Name} ({slumlord.Guid}), {item.Name} ({item.Guid}), {amount}) - Created new item {((newItem.StackSize ?? 1) > 1 ? $"{newItem.StackSize}x " : "")}{newItem.Name} ({newItem.Guid}) and moved to Slumlord."); // force save of new slumlord stack newItem.SaveBiotaToDatabase(); diff --git a/Source/ACE.Server/WorldObjects/Player_Inventory.cs b/Source/ACE.Server/WorldObjects/Player_Inventory.cs index da850b0175..c66ffcc4ac 100644 --- a/Source/ACE.Server/WorldObjects/Player_Inventory.cs +++ b/Source/ACE.Server/WorldObjects/Player_Inventory.cs @@ -3142,7 +3142,8 @@ private bool DoHandleActionStackableMerge(WorldObject sourceStack, WorldObject t if (isFromAPlayerCorpse) { - log.DebugFormat($"[CORPSE] {Name} (0x{Guid}) merged {amount:N0} {(sourceStack.IsDestroyed ? $"which resulted in the destruction" : $"leaving behind {sourceStack.StackSize:N0}")} of {sourceStack.Name} (0x{sourceStack.Guid}) to {targetStack.Name} (0x{targetStack.Guid}) from {sourceStackRootOwner.Name} (0x{sourceStackRootOwner.Guid})"); + if (log.IsDebugEnabled) + log.Debug($"[CORPSE] {Name} (0x{Guid}) merged {amount:N0} {(sourceStack.IsDestroyed ? $"which resulted in the destruction" : $"leaving behind {sourceStack.StackSize:N0}")} of {sourceStack.Name} (0x{sourceStack.Guid}) to {targetStack.Name} (0x{targetStack.Guid}) from {sourceStackRootOwner.Name} (0x{sourceStackRootOwner.Guid})"); targetStack.SaveBiotaToDatabase(); } diff --git a/Source/ACE.Server/WorldObjects/Player_Melee.cs b/Source/ACE.Server/WorldObjects/Player_Melee.cs index 8f9b73d5b1..bd411cbacc 100644 --- a/Source/ACE.Server/WorldObjects/Player_Melee.cs +++ b/Source/ACE.Server/WorldObjects/Player_Melee.cs @@ -104,7 +104,7 @@ public void HandleActionTargetedMeleeAttack(uint targetGuid, uint attackHeight, if (target == null) { - //log.DebugFormat($"{Name}.HandleActionTargetedMeleeAttack({targetGuid:X8}, {AttackHeight}, {powerLevel}) - couldn't find target guid"); + //log.DebugFormat("{0}.HandleActionTargetedMeleeAttack({1:X8}, {2}, {3}) - couldn't find target guid", Name, targetGuid, AttackHeight, powerLevel); OnAttackDone(); return; } diff --git a/Source/ACE.Server/WorldObjects/WorldObject_Decay.cs b/Source/ACE.Server/WorldObjects/WorldObject_Decay.cs index 6f35073273..e8d92b032c 100644 --- a/Source/ACE.Server/WorldObjects/WorldObject_Decay.cs +++ b/Source/ACE.Server/WorldObjects/WorldObject_Decay.cs @@ -132,7 +132,7 @@ public void Decay(TimeSpan elapsed) pukedItems = pukedItems.Substring(0, pukedItems.Length - 2); if(log.IsDebugEnabled) - log.DebugFormat($"[CORPSE] {corpse.Name} (0x{corpse.Guid}) at {corpse.Location.ToLOCString()} has decayed{((pukedItems == "") ? "" : $" and placed the following items on the landblock: {pukedItems}")}."); + log.Debug($"[CORPSE] {corpse.Name} (0x{corpse.Guid}) at {corpse.Location.ToLOCString()} has decayed{((pukedItems == "") ? "" : $" and placed the following items on the landblock: {pukedItems}")}."); } if (corpse != null) diff --git a/Source/ACE.Server/WorldObjects/WorldObject_Generators.cs b/Source/ACE.Server/WorldObjects/WorldObject_Generators.cs index 0d6de20dfe..cdcfd43fcb 100644 --- a/Source/ACE.Server/WorldObjects/WorldObject_Generators.cs +++ b/Source/ACE.Server/WorldObjects/WorldObject_Generators.cs @@ -323,7 +323,7 @@ public bool GenStopSelectProfileConditions if (CurrentCreate >= MaxCreate) { //if (CurrentCreate > InitCreate) - //log.DebugFormat($"{WeenieClassId} - 0x{Guid}:{Name}.StopConditionsInit(): CurrentCreate({CurrentCreate}) > InitCreate({InitCreate})"); + //log.DebugFormat("{0} - 0x{1}:{2}.StopConditionsInit(): CurrentCreate({3}) > InitCreate({4})", WeenieClassId, Guid, Name, CurrentCreate, InitCreate); return true; } diff --git a/Source/ACE.Server/WorldObjects/WorldObject_Weapon.cs b/Source/ACE.Server/WorldObjects/WorldObject_Weapon.cs index 58805a6b12..fb7a0ff5b4 100644 --- a/Source/ACE.Server/WorldObjects/WorldObject_Weapon.cs +++ b/Source/ACE.Server/WorldObjects/WorldObject_Weapon.cs @@ -521,7 +521,7 @@ public static ImbuedEffectType GetRendDamageType(DamageType damageType) case DamageType.Nether: return ImbuedEffectType.NetherRending; default: - //log.DebugFormat($"GetRendDamageType({damageType}) unexpected damage type"); + //log.DebugFormat("GetRendDamageType({0}) unexpected damage type", damageType); return ImbuedEffectType.Undef; } }