Initial commit.
This commit is contained in:
		
						commit
						b457854f23
					
				
					 2 changed files with 45 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								shard.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								shard.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					name: baguette-crystal-base
 | 
				
			||||||
 | 
					version: 0.1.0
 | 
				
			||||||
							
								
								
									
										43
									
								
								src/baguette-crystal-base.cr
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/baguette-crystal-base.cr
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,43 @@
 | 
				
			||||||
 | 
					require "colorize"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Baguette::Context
 | 
				
			||||||
 | 
						class_property verbosity = 1
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Baguette::Log
 | 
				
			||||||
 | 
						# FIXME: Use log files.
 | 
				
			||||||
 | 
						# FIXME: def log(), that puts stuff as-is in the logs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def self.debug(text)
 | 
				
			||||||
 | 
							return unless Baguette::Context.verbosity > 2
 | 
				
			||||||
 | 
							STDERR.puts ":: #{text}".colorize(:cyan)
 | 
				
			||||||
 | 
							STDERR.flush
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						def self.info(text)
 | 
				
			||||||
 | 
							return unless Baguette::Context.verbosity > 1
 | 
				
			||||||
 | 
							STDOUT
 | 
				
			||||||
 | 
								.<<(":: ".colorize(:blue))
 | 
				
			||||||
 | 
								.<<(text.colorize(:white))
 | 
				
			||||||
 | 
								.<<("\n")
 | 
				
			||||||
 | 
							STDOUT.flush
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						def self.title(text)
 | 
				
			||||||
 | 
							return unless Baguette::Context.verbosity > 1
 | 
				
			||||||
 | 
							STDOUT
 | 
				
			||||||
 | 
								.<<("|> ".colorize(:blue).bright)
 | 
				
			||||||
 | 
								.<<(text.colorize(:white).bright)
 | 
				
			||||||
 | 
								.<<("\n")
 | 
				
			||||||
 | 
							STDOUT.flush
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						def self.warning(text)
 | 
				
			||||||
 | 
							return unless Baguette::Context.verbosity > 0
 | 
				
			||||||
 | 
							STDERR.puts ":: #{text}".colorize(:yellow)
 | 
				
			||||||
 | 
							STDERR.flush
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						def self.error(text)
 | 
				
			||||||
 | 
							return unless Baguette::Context.verbosity > 0
 | 
				
			||||||
 | 
							STDERR.puts "!! #{text}".colorize(:red)
 | 
				
			||||||
 | 
							STDERR.flush
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue