Class LogStream
Represents a log stream, which receives all log messages and streams them somewhere.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public class LogStream : IDisposable
Constructors
| Edit this page View SourceLogStream(LoggingCallback)
Constructs a new LogStream.
Declaration
public LogStream(LoggingCallback callback)
Parameters
Type | Name | Description |
---|---|---|
LoggingCallback | callback | Logging callback that is called when messages are received by the log stream. |
LogStream(LoggingCallback, string)
Constructs a new LogStream.
Declaration
public LogStream(LoggingCallback callback, string userData)
Parameters
Type | Name | Description |
---|---|---|
LoggingCallback | callback | Logging callback that is called when messages are received by the log stream. |
string | userData | User-supplied data |
LogStream(bool)
Constructs a new LogStream.
Declaration
protected LogStream(bool initialize = true)
Parameters
Type | Name | Description |
---|---|---|
bool | initialize | Whether to immediately initialize the system by setting up native pointers. Set this to false if you want to manually initialize and use custom function pointers for advanced use cases. |
LogStream(string, bool)
Constructs a new LogStream.
Declaration
protected LogStream(string userData, bool initialize = true)
Parameters
Type | Name | Description |
---|---|---|
string | userData | User-supplied data |
bool | initialize | True if initialize should be immediately called with the default callbacks. Set this to false if your subclass requires a different way to setup the function pointers. |
Properties
| Edit this page View SourceIsAttached
Gets whether or not the logstream is currently attached to the library.
Declaration
public bool IsAttached { get; }
Property Value
Type | Description |
---|---|
bool |
IsDisposed
Gets whether the logstream has been disposed or not.
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
IsVerboseLoggingEnabled
Gets or sets, if verbose logging is enabled globally.
Declaration
public static bool IsVerboseLoggingEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
UserData
Gets or sets the user data to be passed to the callback.
Declaration
public string UserData { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceAttach()
Attaches the logstream to the library.
Declaration
public void Attach()
Detach()
Detaches the logstream from the library.
Declaration
public void Detach()
DetachAllLogstreams()
Detaches all active logstreams from the library.
Declaration
public static void DetachAllLogstreams()
Dispose()
Releases unmanaged resources held by the LogStream. This should not be called by the user if the logstream is currently attached to an assimp importer.
Declaration
public void Dispose()
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | True to release both managed and unmanaged resources; False to release only unmanaged resources. |
~LogStream()
Finalizes an instance of the LogStream class.
Declaration
protected ~LogStream()
GetAttachedLogStreams()
Gets all active logstreams that are currently attached to the library.
Declaration
public static IEnumerable<LogStream> GetAttachedLogStreams()
Returns
Type | Description |
---|---|
IEnumerable<LogStream> | Collection of active logstreams attached to the library. |
Initialize(AiLogStreamCallback, LoggingCallback?, string, nint)
Initializes the stream by setting up native pointers for Assimp to the specified functions.
Declaration
protected void Initialize(AiLogStreamCallback aiLogStreamCallback, LoggingCallback? callback = null, string userData = "", nint assimpUserData = 0)
Parameters
Type | Name | Description |
---|---|---|
AiLogStreamCallback | aiLogStreamCallback | Callback that is marshaled to native code, a reference is held on to avoid it being GC'ed. |
LoggingCallback | callback | User callback, if any. Defaults to console if null. |
string | userData | User data, or empty. |
nint | assimpUserData | Additional assimp user data, if any. |
Log(string)
Logs a message.
Declaration
public void Log(string msg)
Parameters
Type | Name | Description |
---|---|---|
string | msg | Message contents |
LogMessage(string, string)
Override this method to log a message for a subclass of Logstream, if no callback was set.
Declaration
protected virtual void LogMessage(string msg, string userData)
Parameters
Type | Name | Description |
---|---|---|
string | msg | Message |
string | userData | User data |
OnAiLogStreamCallback(string, nint)
Callback for Assimp that handles a message being logged.
Declaration
protected void OnAiLogStreamCallback(string msg, nint userData)
Parameters
Type | Name | Description |
---|---|---|
string | msg | |
nint | userData |
OnAttach()
Called when the log stream has been attached to the assimp importer. At this point it may start receiving messages.
Declaration
protected virtual void OnAttach()
OnDetach()
Called when the log stream has been detatched from the assimp importer. After this point it will stop receiving messages until it is re-attached.
Declaration
protected virtual void OnDetach()