Codeboxes 0.0.1
Loading...
Searching...
No Matches
Codeboxes.Monitor.Monitor Class Referencesealed

The Monitor gives you the option to monitor your application without the need to debug it. More...

Inheritance diagram for Codeboxes.Monitor.Monitor:
Codeboxes.Monitor.Interfaces.IConsole Codeboxes.Monitor.Interfaces.ILogger Codeboxes.Monitor.Interfaces.IPerformanceAnalyzer Codeboxes.Monitor.Interfaces.IStructureHolder

Public Member Functions

void Dispose ()
 Destroys the Monitor instance with all added observers. Removes the Monitor instance from the Instances. If you used the MonitorSetup and/or MonitorSnapshot for the same party you should destroy them, too.
 
void AddCommand (string name, Action action, [AllowNull] string info=null)
 Calls the same function at all IConsole observers.
 
void ReleaseCommand (string name)
 Calls the same function at all IConsole observers.
 
void Trace (string message, [AllowNull] ImpactLevel level=null)
 Calls the same function at all IConsole observers. (A console UI should add this to its view. Use that to show the results of your console Action.)
 
void Log (ImpactLevel level, string message, [AllowNull] object source=null, [AllowNull] string details=null, [AllowNull] ImpactTopic topic=null)
 Calls the same function at all ILogger observers.
 
void PerformanceUpdate (float value, string kind, float limit)
 Calls the same function at all IPerformanceAnalyzer observers.
 
void PerformanceUpdate (float value, string kind)
 Calls the same function at all IPerformanceAnalyzer observers.
 
void AdjustStructure (string nodes, float delta, string key="amount")
 Calls the same function at all IStructureHolder observers.
 
void SetStructure (string nodes, float staid, string key="amount")
 Calls the same function at all IStructureHolder observers.
 
void ReleaseStructure (string nodes)
 Calls the same function at all IStructureHolder observers.
 
- Public Member Functions inherited from Codeboxes.Monitor.Interfaces.IConsole
- Public Member Functions inherited from Codeboxes.Monitor.Interfaces.ILogger
- Public Member Functions inherited from Codeboxes.Monitor.Interfaces.IPerformanceAnalyzer
- Public Member Functions inherited from Codeboxes.Monitor.Interfaces.IStructureHolder

Static Public Member Functions

static Monitor Instance ([AllowNull] string party=null)
 Returns a Monitor instance for the given party. Each party has its very own Monitor instance, so the stuff from different frameworks or parties of the project are divided. It is not allowed to have another Monitor instance for the same party. You can use the classes MonitorSetup and MonitorSnapshot in the same way.
 
static void AddObserver (IMonitorObserver observer)
 Adds an IMonitorObserver. The observer gets informed by calling the function monitorAdded, when a new Monitor instance gets added. The observer gets informed by calling the function monitorRemoved, when a Monitor instance gets removed/destroyed. At adding that observer the function monitorAdded will be called at it for each previously added Monitor instance. In result, while the observer is added, it will always know which Monitor instances are existing.
 
static void RemoveObserver (IMonitorObserver observer)
 Removes an added observer. The observer will not longer be informed, when a Monitor instance gets added or removed.
 

Properties

String Party [get]
 
List< IConsole > Consoles [get]
 The list of all console observers. These objects are getting called, by the Monitor functions AddCommand, ReleaseCommand Trace. You can Add your own IConsole instance as you want. Keep in mind to Dispose the IConsole if you remove it from the list. Also, your IConsole instance will get Disposed, too, when this Monitor instance is getting Disposed.
 
List< ILogger > Logger [get]
 The list of all logging observers. These objects are getting called, by the Monitor function Log. You can Add your own ILogger instance as you want. Keep in mind to Dispose the ILogger if you remove it from the list. Also, your ILogger instance will get Disposed, too, when this Monitor instance is getting Disposed.
 
List< IPerformanceAnalyzer > Performances [get]
 The list of all performance observers. These objects are getting called, by the Monitor function PerformanceUpdate. You can Add your own IPerformanceAnalyzer instance as you want. Keep in mind to Dispose the IPerformanceAnalyzer if you remove it from the list. Also, your IPerformanceAnalyzer instance will get Disposed, too, when this Monitor instance is getting Disposed.
IMPORTANT
Due to, that the performance is an application wide topic, the list of all IPerformanceAnalyzer observers is static, although this is a member getter. This means, that all Monitor instances are handling the same performance observers and onyl the last one disposing will dispose your IPerformanceAnalyzer, too.
 
List< IStructureHolder > Structures [get]
 The list of all structure observers. These objects are getting called, by the Monitor function AdjustStructure, SetStructure and ReleaseStructure. You can Add your own IStructureHolder instance as you want. Keep in mind to Dispose the IStructureHolder if you remove it from the list. Also, your IStructureHolder instance will get Disposed, too, when this Monitor instance is getting Disposed.
 

Detailed Description

The Monitor gives you the option to monitor your application without the need to debug it.

The Monitor is technically just a holder of some specific observers.

Calling a function on the Monitor without any added observers will have no effect and throw no error. But when an observer was added, the function call will be forwarded to it.

You can use the Monitor with different parties. Each party will have an own Monitor instance. If you try to create another Monitor for the same party it will throw an error. The codeboxes libraries are using the Codeboxes.PARTY to divide the codeboxes stuff from your own.

When you add the codeboxes monitor lib to your project, you can handle all the logs, structures, performances and consoles. You can use the build in classes, or create your very own ones.

If you don't want to rifle through the whole library, to set your monitor usage up, I recommend you the MonitorSetup class. The 'standard' member of it will setup your monitor in a standardized way with just one or two function calls. Please see the documentation of that class for further information.

You can use the Monitor in combination with an included UI, or an external app. Just see the documentation of the classes MonitorScreen and MonitorConnector for further information.

Member Function Documentation

◆ AddCommand()

void Codeboxes.Monitor.Monitor.AddCommand ( string name,
Action action,
[AllowNull] string info = null )
inline

Calls the same function at all IConsole observers.

Parameters
namethe name of the Action
actionthe Action to execute via the name
infoan information, which can be displayed in a console UI to understand what the Action does

Implements Codeboxes.Monitor.Interfaces.IConsole.

◆ AddObserver()

static void Codeboxes.Monitor.Monitor.AddObserver ( IMonitorObserver observer)
inlinestatic

Adds an IMonitorObserver. The observer gets informed by calling the function monitorAdded, when a new Monitor instance gets added. The observer gets informed by calling the function monitorRemoved, when a Monitor instance gets removed/destroyed. At adding that observer the function monitorAdded will be called at it for each previously added Monitor instance. In result, while the observer is added, it will always know which Monitor instances are existing.

Parameters
observerthe observer to add and who wants to know which Monitor instance are existing

◆ AdjustStructure()

void Codeboxes.Monitor.Monitor.AdjustStructure ( string nodes,
float delta,
string key = "amount" )
inline

Calls the same function at all IStructureHolder observers.

Parameters
nodesthe structure nodes (use it like this: "root/node/subnode" so the structure UI can handle it)
deltathe amount to add; if the structure is unknown, the value will be set by the amount
keythe key to the amount (the structure UI should handle more than one amount per nodes by this key)

Implements Codeboxes.Monitor.Interfaces.IStructureHolder.

◆ Dispose()

void Codeboxes.Monitor.Monitor.Dispose ( )
inline

Destroys the Monitor instance with all added observers. Removes the Monitor instance from the Instances. If you used the MonitorSetup and/or MonitorSnapshot for the same party you should destroy them, too.

◆ Instance()

static Monitor Codeboxes.Monitor.Monitor.Instance ( [AllowNull] string party = null)
inlinestatic

Returns a Monitor instance for the given party. Each party has its very own Monitor instance, so the stuff from different frameworks or parties of the project are divided. It is not allowed to have another Monitor instance for the same party. You can use the classes MonitorSetup and MonitorSnapshot in the same way.

Parameters
partythe party for which the Monitor is wanted
Returns
Monitor instance for the given party

◆ Log()

void Codeboxes.Monitor.Monitor.Log ( ImpactLevel level,
string message,
[AllowNull] object source = null,
[AllowNull] string details = null,
[AllowNull] ImpactTopic topic = null )
inline

Calls the same function at all ILogger observers.

Parameters
levelthe level of the log entry
messagethe message of the log entry aka the short info
sourcethe source of the log entry
detailsthe stacktrace of an error or the long info
topicthe topic of the log entry

Implements Codeboxes.Monitor.Interfaces.ILogger.

◆ PerformanceUpdate() [1/2]

void Codeboxes.Monitor.Monitor.PerformanceUpdate ( float value,
string kind )
inline

Calls the same function at all IPerformanceAnalyzer observers.

Parameters
valuethe current performance value
kindthe kind aka currency of the value

Implements Codeboxes.Monitor.Interfaces.IPerformanceAnalyzer.

◆ PerformanceUpdate() [2/2]

void Codeboxes.Monitor.Monitor.PerformanceUpdate ( float value,
string kind,
float limit )
inline

Calls the same function at all IPerformanceAnalyzer observers.

Parameters
valuethe current performance value
kindthe kind aka currency of the value
limitthe upper border of the value ... or lower border

Implements Codeboxes.Monitor.Interfaces.IPerformanceAnalyzer.

◆ ReleaseCommand()

void Codeboxes.Monitor.Monitor.ReleaseCommand ( string name)
inline

Calls the same function at all IConsole observers.

Parameters
namethe name of the Action to release

Implements Codeboxes.Monitor.Interfaces.IConsole.

◆ ReleaseStructure()

void Codeboxes.Monitor.Monitor.ReleaseStructure ( string nodes)
inline

Calls the same function at all IStructureHolder observers.

Parameters
nodesthe structure nodes (use it like this: "root/node/subnode" so the structure UI can handle it) to release/remove

Implements Codeboxes.Monitor.Interfaces.IStructureHolder.

◆ RemoveObserver()

static void Codeboxes.Monitor.Monitor.RemoveObserver ( IMonitorObserver observer)
inlinestatic

Removes an added observer. The observer will not longer be informed, when a Monitor instance gets added or removed.

Parameters
observerthe observer to remove

◆ SetStructure()

void Codeboxes.Monitor.Monitor.SetStructure ( string nodes,
float staid,
string key = "amount" )
inline

Calls the same function at all IStructureHolder observers.

Parameters
nodesthe structure nodes (use it like this: "root/node/subnode" so the structure UI can handle it)
staidthe amount to set; if the structure is known, the value will be overwritten
keythe key to the amount (the structure UI should handle more than one amount per nodes by this key)

Implements Codeboxes.Monitor.Interfaces.IStructureHolder.

◆ Trace()

void Codeboxes.Monitor.Monitor.Trace ( string message,
[AllowNull] ImpactLevel level = null )
inline

Calls the same function at all IConsole observers. (A console UI should add this to its view. Use that to show the results of your console Action.)

Parameters
messagethe message to trace
levelthe impact of the message

Implements Codeboxes.Monitor.Interfaces.IConsole.

Property Documentation

◆ Consoles

List<IConsole> Codeboxes.Monitor.Monitor.Consoles
get

The list of all console observers. These objects are getting called, by the Monitor functions AddCommand, ReleaseCommand Trace. You can Add your own IConsole instance as you want. Keep in mind to Dispose the IConsole if you remove it from the list. Also, your IConsole instance will get Disposed, too, when this Monitor instance is getting Disposed.

◆ Logger

List<ILogger> Codeboxes.Monitor.Monitor.Logger
get

The list of all logging observers. These objects are getting called, by the Monitor function Log. You can Add your own ILogger instance as you want. Keep in mind to Dispose the ILogger if you remove it from the list. Also, your ILogger instance will get Disposed, too, when this Monitor instance is getting Disposed.

◆ Party

String Codeboxes.Monitor.Monitor.Party
get

The party for which the Monitor instance was created. This is a unique key.

◆ Performances

List<IPerformanceAnalyzer> Codeboxes.Monitor.Monitor.Performances
get

The list of all performance observers. These objects are getting called, by the Monitor function PerformanceUpdate. You can Add your own IPerformanceAnalyzer instance as you want. Keep in mind to Dispose the IPerformanceAnalyzer if you remove it from the list. Also, your IPerformanceAnalyzer instance will get Disposed, too, when this Monitor instance is getting Disposed.
IMPORTANT
Due to, that the performance is an application wide topic, the list of all IPerformanceAnalyzer observers is static, although this is a member getter. This means, that all Monitor instances are handling the same performance observers and onyl the last one disposing will dispose your IPerformanceAnalyzer, too.

◆ Structures

List<IStructureHolder> Codeboxes.Monitor.Monitor.Structures
get

The list of all structure observers. These objects are getting called, by the Monitor function AdjustStructure, SetStructure and ReleaseStructure. You can Add your own IStructureHolder instance as you want. Keep in mind to Dispose the IStructureHolder if you remove it from the list. Also, your IStructureHolder instance will get Disposed, too, when this Monitor instance is getting Disposed.


The documentation for this class was generated from the following file: