mirror of
				https://github.com/clearml/clearml-docs
				synced 2025-06-26 18:17:44 +00:00 
			
		
		
		
	Update text reporting example
This commit is contained in:
		
							parent
							
								
									e83c27c23b
								
							
						
					
					
						commit
						3f4fc3e4f0
					
				@ -3,15 +3,46 @@ title: Text Reporting
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The [text_reporting.py](https://github.com/clearml/clearml/blob/master/examples/reporting/text_reporting.py) script 
 | 
			
		||||
demonstrates reporting explicit text by calling [`Logger.report_text()`](../../references/sdk/logger.md#report_text). 
 | 
			
		||||
 | 
			
		||||
ClearML reports the text in the **ClearML Web UI**, in the task's **CONSOLE** tab. 
 | 
			
		||||
demonstrates reporting text output and samples. 
 | 
			
		||||
 | 
			
		||||
When the script runs, it creates a task named `text reporting` in the `examples` project.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Reporting Text to Console
 | 
			
		||||
To report text to the task console, call [`Logger.report_text()`](../../references/sdk/logger.md#report_text)
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
# report text
 | 
			
		||||
Logger.current_logger().report_text("hello, this is plain text")
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
Text reported with `Logger.report_text()` appears in the task's **CONSOLE** tab in the ClearML Web UI. 
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Reporting Text as Debug Samples
 | 
			
		||||
To report longer text as a debug sample (e.g., logs, large text outputs, or structured text files),
 | 
			
		||||
use [`Logger.report_media()`](../../references/sdk/logger.md#report_media) with a text stream and `.txt` file extension.
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
text_to_send = """
 | 
			
		||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 | 
			
		||||
Suspendisse ac justo ut dolor scelerisque posuere.
 | 
			
		||||
...
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
Logger.current_logger().report_media(
 | 
			
		||||
    title="text title",
 | 
			
		||||
    series="text series",
 | 
			
		||||
    iteration=1,
 | 
			
		||||
    stream=six.StringIO(text_to_send),
 | 
			
		||||
    file_extension=".txt",
 | 
			
		||||
)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Text samples appear in the task's **DEBUG SAMPLES** tab in the ClearML Web UI.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 52 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_dark.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_dark.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 53 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_debug.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_debug.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 50 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_debug_dark.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/img/examples_reporting_text_debug_dark.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 46 KiB  | 
		Loading…
	
		Reference in New Issue
	
	Block a user